I'm trying to set up a scheduled backup job with xsibackup and the root crontab but can't get it to fire... I've tried everything I can think of including the troubleshooting steps in the xsibackup manual.
I have a job (001) setup and saved in xsi-dir/jobs and have confirmed that it runs manually without any error.
I have edited the xsi-dir/conf/root-crontab file and added in the job as specified in the manual - for example:
30 5 * * * "/vmfs/volumes/datastore1/xsi-dir/jobs/001" > /dev/null 2>&1
I then run the --update-cron command, and manually confirm that it has been added in the root crontab.
I also have a cron test running that outputs the date to a file every minute which confirms that cron is working correctly. However, the xsibackup job never runs, and I get no output whatsoever in the xsi-dir/var/logs/xsibackup.log file.
I have also tried:
> Manually restarting the cron service (but it doesn't seem to be the issue as I have confirmed cron is working correctly)
> Trying other syntax in the cron to get xsibackup to run - such as using the command "/vmfs/volumes/datastore1/xsi-dir/xsibackup --run-backup=001" to no avail.
Can anyone identify what else might be the problem here and how I can get xsibackup to run from cron?
Try to redirect the cron job itself to /dev/null, add: > /dev/null 2>&1 at the end of the job and see it it helps.
"/vmfs/volumes/datastore1/xsi-dir/xsibackup" \ --backup-prog=Vmkfstools \ --date-dir=yes \ --backup-point=/vmfs/volumes/backup1/ \ --backup-type=Custom \ --backup-vms="VM1, VM2, VM3" \ --backup-how=Hot \ --use-smtp=1 \ --firstname.lastname@example.org \ --backup-id=001 \ --description="Test job" \ --exec=yes >> "/vmfs/volumes/datastore1/xsi-dir/var/logs/xsibackup.log" > /dev/null 2>&1
Thanks for the suggestion. However it didn't seem to help, unfortunately.
Here is my job file located at xsi-dir/jobs/001:
(I am currently using the 'test-mode' variable whilst troubleshooting)
"/vmfs/volumes/OS/xsi-dir/xsibackup" \ --backup-prog=vmkfstools \ --backup-point=/vmfs/volumes/intbackup \ --backup-type=all \ --backup-how=hot \ --date-dir=yes --use-smtp=1 \ --mail-to=******@******.com \ --backup-id=001 \ --description="vmkfstools backup of all VMs" \ --test-mode=true --exec=yes >> "/vmfs/volumes/OS/xsi-dir/var/logs/xsibackup.log" > /dev/null 2>&1
Here is the line I would use in the xsi-dir/conf/root-crontab file:
20 06 17 06 * "/vmfs/volumes/OS/xsi-dir/jobs/001" > /dev/null 2>&1
There is a logfile at xsi-dir/var/logs/xsibackup.log but it remains empty...
I'm afraid that ESXi's crond daemon is not just like any other regular Linux daemon, it is in fact the one shipped with Busybox, which is in turn the set of command line tools used by ESXi.
There's not much order in how functionalities are offered by ESXi, the SSH server is a customized independent binary, The LibC library is GLibC, but it has been stripped off some of it's functions and the crond binary is Busybox, which contains random bugs that change from one ESXi version to the next. Some other services are modified Open Source packages and you can find a lot of bugs (intentional or not) in all shell related functionalities.
Try to start with something simpler, i.e.:
* 20 * * * "/vmfs/volumes/OS/xsi-dir/jobs/001" > /dev/null 2>&1
And once you have it working add more options. Try with weekday abbreviations (mon,tue,wed,...) if the numeric values don't work. Also remove the leading zero from 06.
Check your busybox version in ESXi and find the related documentation, that might help you find your answers.
# /usr/lib/vmware/busybox/bin/busybox BusyBox v1.20.2 (2012-12-11 11:54:28 PST) multi-call binary. Copyright (C) 1998-2011 Erik Andersen, Rob Landley, Denys Vlasenko and others. Licensed under GPLv2. See source distribution for full notice. Usage: busybox [function] [arguments]... or: busybox --list or: function [arguments]... BusyBox is a multi-call binary that combines many common Unix utilities into a single executable. Most people will create a link to busybox for each function they wish to use and BusyBox will act like whatever it was invoked as. Currently defined functions: [, [[, addgroup, adduser, ash, awk, basename, cat, chgrp, chmod, chown, chvt, cksum, clear, cp, crond, cut, date, dd, delgroup, deluser, diff, dirname, dnsdomainname, du, echo, egrep, eject, env, expr, false, fdisk, fgrep, find, getty, grep, groups, gunzip, gzip, halt, head, hexdump, hostname, inetd, init, kill, ln, logger, login, ls, lzop, lzopcat, md5sum, mkdir, mkfifo, mknod, mktemp, more, mv, nohup, nslookup, od, passwd, poweroff, printf, readlink, reboot, reset, resize, rm, rmdir, sed, seq, setsid, sh, sha1sum, sha256sum, sha512sum, sleep, sort, stat, stty, sum, sync, tail, tar, tee, test, time, timeout, touch, true, uname, uniq, unlzop, unzip, usleep, vi, watch, wc, wget, which, who, xargs, zcat