Can I Set Process Name?

Drew Tomlinson drew at mykitchentable.net
Tue Jul 8 08:26:47 PDT 2003


----- Original Message ----- 
From: "Simon Barner" <barner at in.tum.de>
To: "Rob" <listone at deathbeforedecaf.net>
Cc: "Drew Tomlinson" <drew at mykitchentable.net>; "FreeBSD Questions"
<freebsd-questions at freebsd.org>
Sent: Tuesday, July 08, 2003 8:14 AM

> > setproctitle(3) - but I don't know how you would call it from perl.

> You can do it by altering the $0 variable:

> #!/usr/bin/perl -w
> use strict;

> $0='Will it work?';

> sleep (10);

> A ps | grep 'Will' gives me:

> 2551  p3  SN     0:00.02 Will it work? (perl)

Thank you both for your answers.  I'm not much of a scripter but I tried
your suggestion with the webmin script.  I found that the actual file is
/usr/local/lib/webmin/miniserv.pl and edited the beginning of the file
as such:

#!/usr/bin/perl
# A very simple perl web server used by Webmin

$0='webmin'

# Require basic libraries
package miniserv;

However when starting the program it dies with the following message:

syntax error at /usr/local/lib/webmin/miniserv.pl line 7, near "package
miniserv"
BEGIN not safe after errors--compilation aborted at
/usr/local/lib/webmin/miniserv.pl line 8.

Is there something really easy I'm missing?  If it's complicated I'm
going to forget it as it's not that important.

Thanks,

Drew




More information about the freebsd-questions mailing list