Skip to content
Advertisement

Run a command every 5 minutes and stop it at the end of that time

I have to run NodeJS application which has to run uninterruptedly, but I need to stop it and restart it every 10 minutes. I’m Working on a dedicated Ubuntu 18.04 machine. I have read something about cron but I don’t know well how it works. Does it stop the command that was run with it?

Advertisement

Answer

You can use forever to run the application, and set up a cron job to restart it in forever every five minutes. As a bonus, forever will also restart it for you if it fails in between cron job executions.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement