0

The following crontab entry doesn't work:

 * * * * if pgrep wine || pgrep -f minecraft; then systemctl stop nbminer; else systemctl start nbminer; fi

But if I put the exact command in a bash script and then use it in the crontab it works:

 * * * * /home/braulio/gitconfig/scripts/minerctl

At the beginning of the crontab I'm using SHELL=/bin/bash, but it doesn't help.

Anything am I missing?

brauliobo
  • 177
  • 8
  • You’re missing that using a script is indeed the easiest solution when your batch job requires anything more than “do something at this time” and the “something” comes with more conditions. – Rob Jul 17 '22 at 08:54
  • gaming is not on topic for serverfault, just use it as a script file. sometimes it is reuiqred to use single/double quotes that it works – djdomi Jul 17 '22 at 11:15

0 Answers0