M HYPE SPLASH
// general

How to make my node restart every X seconds

By Michael Henderson

I want to make my node command (node index.js for example) repeat every X hours. I want it to run the commandline node ., then after X hours to exit the process and node it again. Any ideas?

More info (AFTER EDIT):

Ubuntu Server 18.04

1

1 Answer

You could do it with cron job manual or try a systemd timer service. The latter I've used several times. You'll need to create a service and a corresponding timer for it: A timer ExampleYour script is a service then. So you'd start it with systemctl

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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