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 '17 at 16:30

Your Answer

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

Browse other questions tagged or ask your own question.