There is a really interesting tool to gather informations from a running process. Let´s assume a fellow admin is in her or his well-deserved vacation and now you have to reboot the new machine, because you have to service the memory. Of course you look into the documentation and you find a process that isn´t covered by the documentation and there doesn´t seem to be an startup script or SMF manifest that starts this application. D'oh ... yet another last-minute pre-vacation change ... shouldn't happen, but it does happen.
Let´s assume you found an process called application in the process list:
bash-3.2# ps -ef | grep "application" | grep -v "grep"
root 27943 27888 0 23:08:23 pts/1 0:00 /bin/perl ./application --start --debug --foobar=e3421
jmoekamp 27945 27824 0 23:08:28 pts/2 0:00 grep application
You look into the application source code (it´s a perl script, so this isn´t a problem and you see, that the application uses environment variables for config information. Now you have a problem. What are the correct settings of the environment variables? How can you gather the correct information to startup the application again. Solaris can help here with a programm called
pargs.
At first let´s check the environment of the application first. It´s important to know, that you just can lookup this informations for processes you own. You need to get root privileges to see this information for other processes. Okay, the
pargs command offers the
-e switch for this task.
# pargs -e 27943
27943: /bin/perl ./application --start --debug --foobar=e3421
[...]
envp[3]: DATABASEHOST=foobar.server.de
[...]
envp[6]: USERNAME=snafu
[...]
envp[13]: DATABASEDB=importantdatabase
[...]
There is another interesting switch. You can use
pargs with the
-l switch to get the full command line that was used to start the script, albeit this isn't that interesting, as you could get similar information with
/usr/ucb/ps -auxwwww. But with a known process id
pargs is much more comfortable.
# pargs -l 27943
/usr/perl5/5.8.4/bin/perl ./application --start --debug '--foobar=e3421'
Now you should have all informations to restart the script and -by the way- to update the documentation for the fellow admin.
Comments
Fri, 09.01.2009 01:24
Looks like The Reg have picked up on this as well - they can 't hardly have a week without a Sun share price story. [...]
Thu, 08.01.2009 19:29
I didn´t forget them ... as i wrote about them earlier and i wrote at the beginning "besid es the Sun RIF" ...
Thu, 08.01.2009 19:15
don't forget 6,000 for sun
Thu, 08.01.2009 18:12
Well, from recent history, it looks like banks were way over leveraged compared to your ty pical business, and seem [...]
Thu, 08.01.2009 17:36
I actually think it's a good t ime to add some sun shares to the mix