I wrote a simple script in perl to check if my server is working. If it is not, the script will run it again. This is the script:
#!/usr/bin/perl -w use strict; use warnings; my($command, $name) = ("/full_path_to/my_server", "my_server"); if (`pidof $name`){ print "Process is running!\n"; } else{ `$command &`; }
The scripts work fine when I manually run it, but when I run it in crontab, it cannot find the dynamic libraries used by the server, located in the same folder.
Entrance to Crontab:
*/5 * * * * /usr/bin/perl -w /full_path_to_script/autostartServer
I assume this is a context issue in which the application starts. What is the smart way to solve this problem?
source share