Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- var exec = require('child_process').exec;
- function restart(counter)
- {
- console.log('%d. pm2 restart all', counter);
- exec('pm2 restart all', function(err, stdout, stderr)
- {
- if (err)
- {
- console.error(err.message);
- }
- else
- {
- console.log(stdout);
- if (!/error|stopped/.test(stdout))
- {
- setTimeout(restart, 3600000, counter + 1);
- }
- }
- });
- }
- restart(1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement