<div dir="ltr">Hello everyone,<div><br></div><div>So excited about the Winter Perl Conference that I just registered for that I thought I would rebuild my aged Perl Dancer2 website. I 've done so and deployed it on a Digital Ocean droplet but I've hit a snag in setting up a cron job to make sure starman is running. It seems my query into whether the process is running gets treated as evidence that the process IS running. <br></div><div><br></div><div>When I do:</div><div><br></div><div>perl -e 'my $smstat = `ps -ef | grep starman`; unless ($smstat =~ /starman master/) { system("XDG_RUNTIME_DIR=/run/user/1001 exec /home/starman/<a href="http://starman.pl">starman.pl</a> start &>> /home/starman/starman.log"); print localtime . " starting starman\n"; } else { print "Starman is already running\n\n\n $smstat\n" }';<br><br></div><div>RESULTS IN:</div><div><br></div><div>Starman is already running<br><br><br> starman   203805       1  0 Nov08 ?        00:00:00 /lib/systemd/systemd --user<br>starman   203806  203805  0 Nov08 ?        00:00:00 (sd-pam)<br>root      472040     385  0 Nov20 ?        00:00:00 sshd: starman [priv]<br>starman   472049  472040  0 Nov20 ?        00:00:01 sshd: starman@pts/0<br>starman   472050  472049  0 Nov20 pts/0    00:00:00 -bash<br>starman   544383  472050  0 23:11 pts/0    00:00:00 perl -e my $smstat = `ps -ef | grep starman`; unless ($smstat =~ /starman master/) { system("XDG_RUNTIME_DIR=/run/user/1001 exec /home/starman/<a href="http://starman.pl">starman.pl</a> start &>> /home/starman/starman.log"); print localtime . " starting starman\n"; } else { print "Starman is already running\n\n\n $smstat\n" }<br>starman   544384  544383  0 23:11 pts/0    00:00:00 sh -c ps -ef | grep starman<br>starman   544385  544384  0 23:11 pts/0    00:00:00 ps -ef<br>starman   544386  544384  0 23:11 pts/0    00:00:00 grep starman<br></div><div><br></div><div>It always says it's running even if it is not apparently because it's seeing 'starman master/ in the perl script that is inquiring. </div><div><br></div><div>Anyone know a good solution to avoid this so that I can determine whether my starman startup script is indeed running?</div><div><br></div></div>