I have a node script inside /home/pi/Blynk/script.js. I've followed various posts online relating using cron and /etc/init.d, however none seem to be working. The script must be run via sudo, I've checked the log and it shows the command being run, but it's not running the script. Here is what I added to cron

(This cron below runs the Blynk server and works)

@reboot java -jar /home/pi/server-0.27.1.jar -dataFolder /home/pi/Blynk &

(This cron runs the script with user root and node yet doesn't work)

@reboot /usr/bin/sudo -u root -H /usr/bin/node /home/pi/Blynk/script.js

Could someone please show me where I've gone wrong?

  • Do you get any errors when you check your crontab log? Does it work without any error at all? If so, that seems unusual that it silently fails.
    – Aurora0001
    Sep 18, 2017 at 16:30

1 Answer 1


You named root as the user for sudo - it should have been pi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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