I have this script :


if [ ! -e /home/mam/restart.lock ]; then
    touch /home/mam/restart.lock
    killall arma3server
    /home/mam/arma3server &

I made a cron like that :

* * * * * /home/mam/script.sh

I delete the restart.lock, launch the script by /home/mam/script.sh and it's work : it creates the file, and start the server.

But, when the crontab does it, it just creates the .lock file and doesn't start my server.

Can you explain me why and how to fix it?

Thanks !

  • Try 1 * * * * /bin/bash -xc /home/mam/script.sh >$HOME/error.log 2>&1 and then, after it runs, examine error.log. (If bash on your system is not at /bin/bash, use the actual path.) – John1024 Jul 10 '16 at 18:21
  • You probably need to define a number of environmental variables in your script – fpmurphy Jul 11 '16 at 1:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.