I have made a service which contains some redis operations and node scripts on a ubuntu Amazon Ec2 instance. However when there are any errors the service stops with a pid.
I need a cron job to do the following :
I have seen that cron can be created for time interval but have not come across if this can be done for service fail scenarios as well . Any hints and answers on this will be very helpful .
You can use Forever . From their page:
A simple CLI tool for ensuring that a given script runs continuously (ie forever).
The usage is quite simple:
forever start your_app.js
You can read the documentation in their page: Forever - Github . You have several examples here: Forever examples .
There are other alternatives:
Other alternatives I like (which they're not written in Node.js) are:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.