I'm trying to run two command at reboot on my raspberry pi. Here is what I tried :

@reboot sudo su - pi -c "screen -dm -S myscript_cron python ~/myfolder/myscript.py"
@reboot sudo su - pi -c "screen -dm -S autossh_cron autossh -M 30000 -N my_ssh_config -R 3030:localhost:3030 -C"

The first reboot command is working very well ! However the second one won't start. I activated the cron logs and everything seems correct.

Thanks for your time



It is likely that it cannot start SSH as soon as you have booted due to network connection not being established immediately

@reboot sleep 60; ssh user@hostname

For example should work

  • Nope it's not working either :/ – Simon Robain Apr 10 '17 at 14:17
  • Could you please add the output of the logfile – user3573987 Apr 10 '17 at 14:18
  • It needed a bit more than 60 sec ;) Thx for your help ! – Simon Robain Feb 3 '18 at 22:01

You could set wait for network connection before continuing boot, in case that is the cause. Find it in the raspi-config settings.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.