1

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?

Aurora0001
6,3773 gold badges25 silver badges39 bronze badges
asked Sep 16, 2017 at 15:05
1
  • 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. Commented Sep 18, 2017 at 16:30

1 Answer 1

1

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

answered Nov 24, 2021 at 3:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.