Monday, January 18, 2010

Crontab for other user

crontab -l -u cruise
crontab -e -u cruise

Kill all the process by a user in Linux

kill -9 `ps -ef|grep cruise |awk '{print $2}'`

Monday, January 4, 2010

Last Restart time for Windows workstation

To find out last reboot

Open command prompt and type below command. Second line of the output will display the last restart of workstation/server.

net statistics workstation | more

eg

Workstation Statistics for \\"workstation name"
Statistics since 12/24/2009 4:27 AM

Bytes received 3192754767

Last restart for Windows

To find out last reboot

Open command prompt and type below command. Second Line of the output will display the last start time of the workstation/server.

net statistics workstation | more

Sunday, November 15, 2009

telnet in Windows 7 and Windows Vista

telnet command is by default missing in Windows 7 and Windows Vista.
To solve this, just enable it. Click Start > Control Panel > Programs, and then click Turn Windows Features on or off. Fromn the list, scroll down and select/check Telnet Client. Click OK to start the installation.

After completion of installationy, try telnet using command line. It will work :)

Monday, November 9, 2009

alt_disk_install command

By default, using the alt_disk_install command does the following:
1. Creates an /image.data file based on the current rootvg's configuration. A
customized image.data file can be used.
2. Creates an alternate rootvg (altinst_rootvg).
3. Creates logical volumes and file systems with the alt_inst prefix.
4. Generates a backup file list from the rootvg, and if an exclude.list file is given,
those files are excluded from the list.
5. Copies the final list to the altinst_rootvg's file systems.
6. If specified, the installp command installs updates, fixes, or new filesets into
the alternate file system.
7. The bosboot command creates a boot logical volume on the alternate boot
disk.
8. If a customization script is specified, it runs at this point.
9. The file systems are then unmounted, and the logical volumes and file
systems are renamed.
10.The logical volume definitions are exported from the system to avoid
confusion with identical ODM names, but the altinst_rootvg definition is left as
an ODM placeholder.
11.By default, the bootlist is set to the new cloned rootvg for the next reboot.

Tuesday, March 24, 2009

Apache restart with Sudo Permission - Issue

Unfortunately, this issue ate my 5 days to fix this issue.
and the resolution was very very small compare to time take by it.

Issue :
While restarting apache with sudo access it was throwing some exception, while same with root was working fine.

Exception :
$ sudo /etc/init.d/apache restart
[Tue Mar 17 17:01:45 2009] [warn] PassEnv variable LD_LIBRARY_PATH was undefined
[Tue Mar 17 17:01:45 2009] [warn] PassEnv variable JAVA_BINDIR was undefined
[Tue Mar 17 17:01:45 2009] [warn] PassEnv variable JAVA_HOME was undefined
[Tue Mar 17 17:01:45 2009] [warn] PassEnv variable JAVA_ROOT was undefined
[Tue Mar 17 17:01:45 2009] [warn] PassEnv variable JDK_HOME was undefined
[Tue Mar 17 17:01:45 2009] [warn] PassEnv variable JRE_HOME was undefined
[Tue Mar 17 17:01:45 2009] [warn] PassEnv variable JRUBY_HOME was undefined
[Tue Mar 17 17:01:45 2009] [warn] PassEnv variable ORACLE_HOME was undefined
Syntax OK
Shutting down httpd2 (waiting for all children to terminate) done
Starting httpd2 (prefork) [Tue Mar 17 17:01:47 2009] [warn] PassEnv variable LD_LIBRARY_PATH was undefined
[Tue Mar 17 17:01:47 2009] [warn] PassEnv variable JAVA_BINDIR was undefined
[Tue Mar 17 17:01:47 2009] [warn] PassEnv variable JAVA_HOME was undefined
[Tue Mar 17 17:01:47 2009] [warn] PassEnv variable JAVA_ROOT was undefined
[Tue Mar 17 17:01:47 2009] [warn] PassEnv variable JDK_HOME was undefined
[Tue Mar 17 17:01:47 2009] [warn] PassEnv variable JRE_HOME was undefined
[Tue Mar 17 17:01:47 2009] [warn] PassEnv variable JRUBY_HOME was undefined
[Tue Mar 17 17:01:47 2009] [warn] PassEnv variable ORACLE_HOME was undefined
done

Resolution :

Since apache is not able to find above environment variable of user shell, its throwing the exception, so to restart the apache use option -i ( to preserver exception)

The -i (simulate initial login) option runs the shell specified in the passwd(5) entry of the user that the command is being run as. The comâmand name argument given to the shell begins with a - to tell the shell to run as a login shell. sudo attempts to change to that user's home directory before running the shell. It also initializes the environment, leaving TERM unchanged, setting HOME, SHELL, USER, LOGNAME, and PATH, and unsetting all other environment variables. Note that because the shell to use is determined before the sudoers file is parsed, a runas_default setting in sudoers will specify the user to run the shell as but will not affect which shell is actually run.

Make sure you have to execute the below command, if you are facing issue while executing this add " (root) NOPASSWD: /bin/bash /etc/init.d/apache2 *" in /etc/sudoers file

$ sudo -i /etc/init.d/apache restart

Syntax OK
Shutting down httpd2 (waiting for all children to terminate) done
Starting httpd2 (prefork) done

WOW !!