I have a script that starts up a program of mine. I want it to run at boot. It works fine when I put it in crontab -e, but when I put it in sudo crontab -e nothing happens, not even a log file is produced. I wonder what could be the reason for it? I need root access for accessing the serial port in a new version of that program.

The crontab command is:

@reboot sh ~/project/tensorrt_demos/launcher2.sh >> ~/project/tensorrt_demos/smart_bike.log 2>&1
  • Always use fully qualified paths. Jul 3, 2021 at 18:40
  • ~ is in the user's context. It will be different for root than for your user account. (But I don't think sh understands it anyway.)
    – roaima
    Jul 3, 2021 at 18:42
  • "I need root access for accessing the serial port" or you could relax the permissions on the serial port so you didn't need root for running your application
    – roaima
    Jul 3, 2021 at 18:45

1 Answer 1


As mentioned in the comments the problem was indeed the relative paths. Changing that fixed it.

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.