#1 2018-05-09 07:53:45

daniel_lovo
Member
Registered: 2018-05-09
Posts: 1

XSIBackup cron autostart problem

Hello,

I have a problem with running sometimes, the backup does not always start.

For example: on Wednesday script did not start

ver. XSIBACKUP-PRO 10.3.3
ESXI 6.0.0 Update 3 (Build 6765062)

xsibackup-cron:
#!/bin/sh
# This is your XSIBackup crontab, you can add your backup schedules here
# You can use regular XSIBackup commands appending the parameter --time="Day HH:mm", i.e. --time="Mon 21:57"
# The --time format is compounded by three letters weekday acronym (Mon,Tue,Wed,Thu,Fri,Sat,Sun) + space + hh:mm
# You can add multiple "moments" in a --time argument separated by a pipeline | like: Mon 17:31|Tue 21:33|Sun 19:21
#
############# This actually deletes backups older than 7 days #####################

find /vmfs/volumes/BACKUP-VM/vm1/* -maxdepth 1 -type d -mtime +7 -exec rm -rf {} \;

############## Not the schedules to do the backups of the VM’s #################
# VM1-NODE #
# mon-fri #
"/vmfs/volumes/datastore1/xsi-dir/xsibackup" --time="Mon 01:03|Tue 01:03|Wed 01:03|Thu 01:03|Fri 01:03" --date-dir=yes --backup-point="/vmfs/volumes/BACKUP-VM/vm1" --backup-type=custom  --backup-vms="VM1,VM2"  --mail-from=xxx --mail-to=xxx --smtp-srv=xxx --smtp-port=25 --smtp-usr=xxx --smtp-pwd=xxx

# sat-sun #
"/vmfs/volumes/datastore1/xsi-dir/xsibackup" --time="Sat 01:31|Sun 01:31" --date-dir=yes --backup-point="/vmfs/volumes/BACKUP-VM/vm1" --backup-type=custom --backup-vms="VM3,VM4,VM5"  --mail-from=xxx --mail-to=xxx --smtp-srv=xxx --smtp-port=25 --smtp-usr=xxx --smtp-pwd=xxx

sysylog.log (Wed):
2018-05-09T01:02:01Z crond[19771704]: crond: USER root pid 22145837 cmd '/vmfs/volumes/datastore1/xsi-dir/xsibackup-cron' | sed '/\r/d' >> '/vmfs/volumes/datastore1/xsi-dir/xsibackup-cron.log' 2>&1
2018-05-09T01:03:01Z crond[19771704]: crond: user root: process already running: '/vmfs/volumes/datastore1/xsi-dir/xsibackup-cron' | sed '/\r/d' >> '/vmfs/volumes/datastore1/xsi-dir/xsibackup-cron.log' 2>&1

cronpid=$(cat /var/run/crond.pid) && ps | grep "$cronpid"
19771704  19771704  busybox

vi /var/spool/cron/crontabs/root
#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  *    *   *   *   /sbin/hostd-probe ++group=host/vim/vmvisor/hostd-probe
00   1    *   *   *   localcli storage core device purge
*/1 * * * * '/vmfs/volumes/datastore1/xsi-dir/xsibackup-cron' | sed '/\r/d' >> '/vmfs/volumes/datastore1/xsi-dir/xsibackup-cron.log' 2>&1

vi /etc/rc.local.d/local.sh
#!/bin/sh

# local configuration options

# Note: modify at your own risk!  If you do/use anything in this
# script that is not part of a stable API (relying on files to be in
# specific places, specific tools, specific output, etc) there is a
# possibility you will end up with a broken system after patching or
# upgrading.  Changes are not supported unless under direction of
# VMware support.

/bin/kill $(cat /var/run/crond.pid) && /bin/echo "*/1 * * * * '/vmfs/volumes/datastore1/xsi-dir/xsibackup-cron' | sed '/\r/d' >> '/vmfs/volumes/datastore1/xsi-dir/xsibackup-cron.log' 2>&1" >> /var/spool/cron/crotabs/root && /usr/lib/vmware/busybox/bin/busybox crond

exit 0

Please help.

Last edited by daniel_lovo (2018-05-09 10:14:55)

Offline

#2 2018-05-09 15:26:15

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

Re: XSIBackup cron autostart problem

We have been testing the crontab for years, you can fall into different issues, which are generally easy to fix.
Read this: https://33hops.com/xsibackup-cron-how-to.html

You can verify that the crontab is working by adding something like

echo "Hello World!" 

At the top of your xsibackup-cron file. You can then use a tail -f

tail -f /vmfs/volumes/datastore1/xsi-dir/xsibackup-cron.log

And you will se a "Hello World!" printed out in screen every minute.
If that should not happen, then restart your cron service or reboot the host if nothing else works.

#Stop crond service
/bin/kill -9 $(cat /var/run/crond.pid)
#Start crond service
/usr/lib/vmware/busybox/bin/busybox crond

Offline

Board footer