bikeNomad has asked for the wisdom of the Perl Monks concerning the following question:
The problem is that when I go to stop my Perl daemon, the start-stop-daemon can't find the process. It looks at the PID and determines that the name of the running process is not the same as the script name (of course, the running process is named "perl").
I've tried assigning to $0 to fake the name, but this doesn't work either (the name does not compare the same). It also seems that assigning to $0 does something funny to the apparent process name; this program:
#!/usr/bin/perl -w my $pid = fork; exit if $pid; $0 = "a"; sleep 60;
causes ps to show the name of the process as "a" followed by over 900 spaces.
I have also tried changing the --name and --exec options to start-stop-daemon to various flavors of perl, /usr/bin/perl, "/usr/bin/perl myscript.pl", all without success.
Has anyone got an idea of how to get this working? The reason I wanted to use start-stop-daemon is that it looks at the process information to determine whether the PID in the file is in fact valid.