#1 2018-07-19 13:53:22

derilium
Member
Registered: 2018-07-19
Posts: 24

Problem getting XSIBackup Pro squeduled under cron

I have been using different versions of XSIbackup over the years and it has been a great bit of software, it has been very easy to deploy and get up and running. On the latest version 11.0.2 Pro i'm really struggling to get it to run on a schedule using cron.

I have a job called 001 containing this:-

# This is a backup job file example. It starts with the path to your
# xsibackup file and ends with the redirection to the log file. Please
# do make sure that you keep first and last lines, changing paths to
# match your working environment.

"/vmfs/volumes/datastore001/xsi-dir" \
--backup-prog=vmkfstools \
--certify-backup=yes \
--backup-point=/vmfs/volumes/VMDatastore/backups/$( date +%Y%m'00000000' ) \
--backup-type=Running \
--backup-how=Hot \
--remote-xsipath=/vmfs/volumes/datastore001/xsi-dir \
--use-smtp=2 \
--mail-to=robert.burnhope@bbsr.co.uk \
--backup-id=001 \
--description="VMKFSTOOLS backup of production VMs" \
--on-success="backupId->002" \
--on-error="backupId->002" \
--exec=yes >> "/vmfs/volumes/datastore001/xsi-dir/var/logs/xsibackup.log"

I have a root-crontab:-
# This crontab belongs to the root user, thus it starts by root-
# Add cron jobs to this file in the classic crond Linux way.
# This is an example of a backup job being run everyday at 2:00 a.m.
# change according to your needs and run ./xsibackup --update-cron
# min hour day mon dow command
0 13 * * * "/vmfs/volumes/datastore001/xsi-dir/jobs/001"

There is nothing in the xsibackup.log but in xsibackup-cron.log there is multiple /bin/sh: /vmfs/volumes/datastore001/xsi-dir/xsibackup-cron: not found

If i run the command to backup the VM's manually ./xsibackup --backup-point=/vmfs/volumes/fa325c13-314f304a/backups --backup-type=running --date-dir=yes --mail-from=no-reply@someemail.com --mail-to=jo.bloggs@someemail.com --smtp-srv=smtp.soememail.com --smtp-port=465 --smtp-usr=bbsysnoreply@gmail.com --smtp-pwd=password --test-mode=true the test works and also by removing test it completes the backup

to add to this i have a root cron containing this:-
#min hour day mon dow command
1    1    *   *   *   /sbin/tmpwatch.py
1    *    *   *   *   /sbin/auto-backup.sh
0    *    *   *   *   /usr/lib/vmware/vmksummary/log-heartbeat.py
*/5  *    *   *   *   /bin/hostd-probe.sh ++group=host/vim/vmvisor/hostd-probe/stats/sh
00   1    *   *   *   localcli storage core device purge
*/1 * * * * '/vmfs/volumes/datastore001/xsi-dir/xsibackup-cron' >> '/vmfs/volumes/datastore001/xsi-dir/xsibackup-cron.log' 2>&1
0 13 * * * "/vmfs/volumes/datastore001/xsi-dir/jobs/001" # Added by XSIBackup


Where am i going wrong?

thanks

rob

Last edited by derilium (2018-07-19 13:54:46)

Offline

#2 2018-07-19 14:39:34

admin
Administrator
Registered: 2017-04-21
Posts: 1,364

Re: Problem getting XSIBackup Pro squeduled under cron

You are mixing features from the older version with your new installation.

*/1 * * * * '/vmfs/volumes/datastore001/xsi-dir/xsibackup-cron' >> '/vmfs/volumes/datastore001/xsi-dir/xsibackup-cron.log' 2>&1

The above is the call to the old crontab, which is what you see in the old log file (xsibackup-cron.log): /vmfs/volumes/datastore001/xsi-dir/xsibackup-cron: not found

That ESXi root crontab line should have been removed when installing the new cron by simply running --install-cron again. You might have skipped this step.

Solution:

Remove the above line manually from /var/spool/cron/crontabs/root or run --install-cron

Online

#3 2018-07-20 07:55:57

derilium
Member
Registered: 2018-07-19
Posts: 24

Re: Problem getting XSIBackup Pro squeduled under cron

Thanks, i have removed the line, ran the update on cron and its still not firing (it was scheduled for last night and didn't kick in) anything else that i have missed.

Offline

#4 2018-07-20 11:08:28

admin
Administrator
Registered: 2017-04-21
Posts: 1,364

Re: Problem getting XSIBackup Pro squeduled under cron

Have you checked the xsibackup.log file, to verify if the cron is working?

tail -n30 /vmfs/volumes/datastore001/xsi-dir/var/logs/xsibackup.log

The ESXi crond daemon can be picky, as it lacks any service control scripts or management mechanism, you need to manage it manually as any other linux binary, so start by making sure that it's loaded just once.

ps -c | grep -v grep | grep 'busybox crond'

If you see more than one line in the output, kill all and start it again.

/usr/lib/vmware/busybox/bin/busybox crond

Everything is explained in more detail here: https://33hops.com/xsibackup-cron-how-to.html
If you can, just reboot the server, it will produce the same effect.

You just need to get used to how this ESXi busybox cron daemon works, it's primitive but effective. In regards to how XSIBackup uses it, it's quite simple: jobs are simply called from /var/spool/cron/crontabs/root, it's in fact simpler than the old XSIBackup cron.

So, make sure that you have the entries that you want there. You can check the cron is working by just adding a line like this to your crontab at: /var/spool/cron/crontabs/root

*/1 * * * * echo "$(date)" >> /tmp/my-cron-test.txt

You should then see a line being recorded there every minute, you can use this command in a different window:

tail -f /tmp/my-cron-test.txt

Online

#5 2018-07-20 11:15:21

derilium
Member
Registered: 2018-07-19
Posts: 24

Re: Problem getting XSIBackup Pro squeduled under cron

Thanks for coming back to me, i can only assume the install must have not gone through ok as i don't have a xsibackup.log in the location you mention, its in the xsi-dir/var/logs folder and the file is empty

As for the one line i get 67694 67694 busybox /usr/lib/vmware/busybox/bin/busybox crond

I think the only option would be to uninstall and start again, would you agree and if thats the case whats the best way of doing it?

Offline

#6 2018-07-20 11:18:50

admin
Administrator
Registered: 2017-04-21
Posts: 1,364

Re: Problem getting XSIBackup Pro squeduled under cron

Sorry, the path is /vmfs/volumes/datastore001/xsi-dir/var/logs/xsibackup.log
We are editing the forum at the same time, so just refresh and see the above post updated.

You don't need to remove everything, but if that makes you feel more confident, just remove the xsi-dir folder, the entries in the  /var/spool/cron/crontabs/root file and the call to reinitialize the cron at /etc/rc.local.d/local.sh

That will leave you with a totally clean ESXi host in regards to XSIBackup

Online

Board footer