1. Create a script
2. Edit "vi /var/spool/cron/crontabs/root" (to wrtire press i, delete line <esc> :d <enter>, to save <esc> :wq! <enter>)
3. Add the line (all on one line) 5 0 * * * /full/path/to/script arguments/with/full/path > /full/path/to/logfile 2>&1
10 6 * * 0 /vmfs/volumes/datastore1/trintukas.sh >> /vmfs/volumes/datastore1/trintukas.log
* * * * * is minute hour (military time) day month weekday (Sunday=0, Monday = 1, Tuesday = 2, and so on)
Help -> http://www.generateit.net/cron-job/
4. Run the command "cat /var/run/crond.pid"
5. Run the command "kill 12345" where "12345" should be replaced with the number output by the previous command
6. Restart cron "/usr/lib/vmware/busybox/bin/busybox crond"
Now cron will start working but all it's setting will be lost after the reboot. To inject commands into crontab do the following:
8. Edit /etc/rc.local.d/local.sh
At the end of the file right before the "exit 0" statement write this:
/bin/kill $(cat /var/run/crond.pid) # Gets the cron service pid and simply kills it.
/bin/echo '15 6 * * 0 /vmfs/volumes/datastore1/xsibackup --backup-point="192.99.148.50:22:/vmfs/volumes/datastore1/Backup" --backup-type=running >> /vmfs/volumes/datastore1/xsibackup-cron.log' >> /var/spool/cron/crontabs/root
/usr/lib/vmware/busybox/bin/busybox crond