Search code examples
bashcron

Does pidof works in crontab?


I'm trying to do a crontab to check if a process is running and if he doesn't I relaunch it via a script on a server (my script is cloning a repo and reconfiguring everything), here is the crontab line:

* * * * * bash -c "export DISPLAY=:0 && if [[ -z "$(pidof my_process)" ]];then curl my_url | bash;fi"

When I launch the command in my terminal, it works perfectly but in crontab I don't know why but it doesn't launch it, do you have any ideas ?


Solution

  • I'm sorry for the confusion but I've found out what that the cronie service was not running so everything work now, thank you for all your answers.