Operating System - HP-UX
1754862 Members
5745 Online
108827 Solutions
New Discussion

renaming launched process

 
SOLVED
Go to solution
Chartier Jerome
Frequent Advisor

renaming launched process

Hello,

I would like to rename a process launched (just before launching it) in a shell script. In order for this process to appear in the ps command with the renamed ocuurence. Ex:
A process named /usr/sbin/toto.sh to appear like tata under the p^s command.
Is this possible????

Thanks in advance

Regards


Jerome
J@Y
1 REPLY 1
Rodney Hills
Honored Contributor
Solution

Re: renaming launched process

I had to create a small "c" program to call "execl". The program then launched the desired program with my altered name.

Sample-
sprintf( cdentry, PATH, argv[1]);
sprintf( uvname, "%s '* %s'",UVNAME,argv[1]);
x = chdir(cdentry);
if ( x != 0 ) {
fprintf(stderr, "%s not a valid directory\n", argv[1]);
exit(2);
}
x = execl ( CMD , uvname, ARG1, ARG2, (char *)NULL);
perror(" Error from execl\n");

"uvname" has the name I want to appear on "ps" lists. (This program can be compiled with the brain-damaged "c" compiler HP provides).

HTH

-- Rod Hills
There be dragons...