I have seen a lot of times ([1][1], [2][2] )this question, but I didn't find the answer, so here I go.

I'm running **Debian 11**, but I guess it works the same for any Debian-like distro.

My `crontab -e` looks like:

 ...
 @reboot sleep 20 /opt/isPromscaleOnOrOff.sh
 ...

And the content of `isPromscaleOnOrOff.sh`:

 #!/bin/bash
 
 SERVICE="promscale"
 
 if pgrep -x "$SERVICE" >/dev/null
 
 then
 
 echo "$SERVICE is running"
 
 else
 
 echo "$SERVICE is stopped, I will run it now"
 
 nohup promscale --db-name asdf1234--db-password asdf1234 --db-user asdf1234 --db-ssl-mode allow --install-extensions & >> /dev/null
 
 disown
 fi


But when I restart the VM the script isn't runing, tho the cron logs in **/var/log/syslog** show the crontab starting the script.

What I wanna achieve can be easilly done **daemonizing** the process (wich I indeed did), I just wanna know why crontab doesn't start up my script.

 [1]: https://unix.stackexchange.com/questions/280678/crontab-why-wont-it-execute-script
 [2]: https://unix.stackexchange.com/questions/342159/crontab-not-executing-script