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
Sun, 12.10.2008 13:47
You also can find more up-to-d ate GNU stuffs especially pack aged for Solaris by the CSW pr oject: http://www.openc [...]
Sun, 12.10.2008 11:50
Thx a lot for this blog entry! - It matches the coreutils an d the fileutils very well, but I'm still missing some [...]
Sun, 12.10.2008 09:17
1. The blog entry refers to th e tools in the coreutils or fi leutils part .... 2. /usr/s fw/lib ?
Sat, 11.10.2008 23:06
I'm trying to install Bitlbee server on an OpenSolaris box a t Joyent. I get this error: BitlBee configure ./co [...]
Sat, 11.10.2008 14:06
COMSTAR with SAS Target sounds very cool for this setup...Bu t how long is data kept in the sZIL device before it i [...]