public
Last active

Simple reboot example

  • Download Gist
simple_crontab_reboot_example.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
require('crontab').load(cronLoaded);
 
function cronLoaded(err, tab) {
if (err) { console.log(err); process.exit(1); }
 
var command = '/usr/bin/env echo "starting some service..."';
tab.remove(tab.findCommand(command));
 
var item = tab.create(command);
item.everyReboot();
tab.save(cronSaved);
}
function cronSaved(err, tab) {
if (err) { console.log(err); process.exit(1); }
 
console.log('saved');
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.