©XSIBackup-Free: Free Backup Software for ©VMWare ©ESXi

Forum ©XSIBackup: ©VMWare ©ESXi Backup Software


You are not logged in.

#1 2017-09-23 15:19:08

tonydotigr
Member
Registered: 2017-09-23
Posts: 9

CRON job does not start

Have a working command line (all verified to be working manually), but can't get anything to work with cron job.  I don't even see error messages (or anything) in the xsibackup-cron.log.

Ran thru the troubleshooting.

Verified this command was added to /etc/rc.local.d/local.sh (it is all one line, not separated out like guide, but looks correct)
/bin/kill $(cat /var/run/crond.pid) && /bin/echo "*/1 * * * * '/vmfs/volumes/597c7a50-c1a2e08e-6ef1-002655ea7e4d/xsi-dir/xsibackup-cron' >> '/vmfs/volumes/597c7a50-c1a2e08e-6ef1-002655ea7e4d/xsi-dir/xsibackup-cron.log' 2>&1" >> /var/spool/cron/crontabs/root && /usr/lib/vmware/busybox/bin/busybox crond

Verified this command finds cron service cronpid=$(cat /var/run/crond.pid) && ps | grep "$cronpid"
6317  66317  busybox

Verified this command ps -c | grep crond
66317  66317  busybox                              /usr/lib/vmware/busybox/bin/busybox crond
68265  68265  grep                                 grep crond

Cron was installed successfully.  Running esxi free 6.5.0

Any ideas?  Thanks in advance.

Last edited by tonydotigr (2017-09-23 15:41:06)

Offline

#2 2017-09-23 17:00:27

sistemi
Member
Registered: 2017-08-29
Posts: 74

Re: CRON job does not start

why not use the provided function in xsibackup?

save a copy of the xsibackup, if any
run xsibackup --inst-cron

edit the file xsibackup-cron and add your backup jobs

lot of useful articles in blog https://33hops.com/blog-main.asp and man page (c)XSIBackup Classic Man Page

Offline

#3 2017-09-23 18:29:47

tonydotigr
Member
Registered: 2017-09-23
Posts: 9

Re: CRON job does not start

sistemi wrote:

why not use the provided function in xsibackup?

save a copy of the xsibackup, if any
run xsibackup --inst-cron

edit the file xsibackup-cron and add your backup jobs

lot of useful articles in blog https://33hops.com/blog-main.asp and man page (c)XSIBackup Classic Man Page

I've already added my working command to xsi-backup-cron and it doesn't work.  Commands above were verifying that cron is running on the system.  The xsibackup-cron.log is also blank.

After reboot the following command is deleted from /var/spool/cron/crontabs/root everytime.

*/1 * * * * [XSIBackup install dir]/xsibackup-cron >> [XSIBackup install dir]/xsibackup-cron.log 2>&1 

Per the instructions the following command is found in vi /etc/rc.local.d/local.sh though.

/bin/kill $(cat /var/run/crond.pid) && /bin/echo "*/1 * * * * '/vmfs/volumes/597c7a50-c1a2e08e-6ef1-002655ea7e4d/xsi-dir/xsibackup-cron' >> '/vmfs/volumes/597c7a50-c1a2e08e-6ef1-002655ea7e4d/xsi-dir/xsibackup-cron.log' 2>&1" >> /var/spool/cron/crontabs/root && /usr/lib/vmware/busybox/bin/busybox crond

Last edited by tonydotigr (2017-09-23 18:40:58)

Offline

#4 2017-09-25 01:38:05

admin
Administrator
Registered: 2017-04-21
Posts: 2,055

Re: CRON job does not start

The crontab file is not called xsi-backup-cron, but xsibackup-cron

Offline

#5 2017-09-25 01:57:27

tonydotigr
Member
Registered: 2017-09-23
Posts: 9

Re: CRON job does not start

admin wrote:

The crontab file is not called xsi-backup-cron, but xsibackup-cron

Typo, everything is in the xsibackup-cron.  The command works just fine outside.

Offline

#6 2017-09-25 19:52:38

tonydotigr
Member
Registered: 2017-09-23
Posts: 9

Re: CRON job does not start

Any ideas?  All seems to work otherwise.  Run the jobs manual, even email.

Offline

#7 2017-09-28 08:01:35

bheide
Member
Registered: 2017-08-29
Posts: 4

Re: CRON job does not start

Have you checked /var/log/syslog.log?
In my installation there is an entry every minute which looks like this:
2017-09-28T07:59:01Z crond[418094845]: crond: USER root pid 455405701 cmd '/vmfs/volumes/sas01/xsi-dir/xsibackup-cron' >> '/vmfs/volumes/sas01/xsi-dir/xsibackup-cron.log' 2>&1

In the past I had problems because of syntax errors in the xsibackup-cron file and looking into that file gave me the hint.

Offline

#8 2017-09-28 12:23:16

tonydotigr
Member
Registered: 2017-09-23
Posts: 9

Re: CRON job does not start

I've been using this link for troubleshooting.
https://33hops.com/xsibackup-cron-how-to.html

Below is my entry in /etc/rc.local.d/local.sh  The paths are correct.

/bin/kill $(cat /var/run/crond.pid) && /bin/echo "*/1 * * * * '/vmfs/volumes/597c7a50-c1a2e08e-6ef1-002655ea7e4d/xsi-dir/xsibackup-cron' >> '/vmfs/volumes/597c7a50-c1a2e08e-6ef1-002655ea7e4d/xsi-dir/xsibackup-cron.log' 2>&1" >> /var/spool/cron/crontabs/root && /usr/lib/vmware/busybox/bin/busybox crond

I believe the problems might lie in the fact that after a reboot the entry below is removed from /var/spool/cron/crontabs/root

*/1 * * * * /vmfs/volumes/597c7a50-c1a2e08e-6ef1-002655ea7e4d/xsi-dir/xsibackup-cron >> /vmfs/volumes/597c7a50-c1a2e08e-6ef1-002655ea7e4d/xsi-dir/xsibackup-cron.log 2>&1

Here's /var/spool/cron/crontabs/root after a reboot.
#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
~
~

What would cause it to get removed?

Believe I'm not seeing any errors in the logs because it's not even starting.  I've verified the command runs just fine manually, even emailing.

Offline

#9 2017-09-28 19:19:36

admin
Administrator
Registered: 2017-04-21
Posts: 2,055

Re: CRON job does not start

--install-cron takes care of all of that, you don't need to worry about ESXi removing the entries in the /var/spool/cron/crontabs/root file, as the entry at /etc/rc.local.d/local.sh, will add it on every reboot. All of that is explained in the cron related posts.

I don't really know what tonydotigr problem is all about, crontab works out of the box for almost everybody. I would start from scratch and follow procedures thoroughly, you have probably taken a wrong turn somewhere in the process.

Offline

#10 2017-10-03 02:06:10

tonydotigr
Member
Registered: 2017-09-23
Posts: 9

Re: CRON job does not start

I reinstalled and its still not populating the /var/spool/cron/crontabs/root with the entry needed to run XSIBackup.  Why wouldn't the /etc/rc.local.d/local.sh populate it on reboot? 

Below is the entry in /etc/rc.local.d/local.sh  The paths are verified to be correct.
/bin/kill $(cat /var/run/crond.pid) && /bin/echo "*/1 * * * * '/vmfs/volumes/SSD_480GB/xsi-dir/xsibackup-cron' >> '/vmfs/volumes/SSD_480GB/xsi-dir/xsibackup-cron.log' 2>&1" >> /var/spool/cron/crontabs/root && /usr/lib/vmware/busybox/bin/busybox crond

Is there a recommended method to reinstall?

Offline

#11 2017-10-03 02:16:51

tonydotigr
Member
Registered: 2017-09-23
Posts: 9

Re: CRON job does not start

Ok, just reinstalled again.  After a reboot the entry is removed from /var/spool/cron/crontabs/root.  Any idea what would cause this?

Offline

#12 2017-10-03 05:02:42

admin
Administrator
Registered: 2017-04-21
Posts: 2,055

Re: CRON job does not start

That behaviour is totally normal. ESXi's cron (/var/spool/cron/crontabs/root) is not persistent.
Don't ask us why, if you are interested in this subject, just open a topic at VMWare's forum and see if they give you a proper answer.

You do not need to deal with that, XSIBackup offers --install-cron argument to install and uninstall the crontab with just a keystroke. If you experience problems like the one you are describing, please read this post thoroughly
https://33hops.com/xsibackup-cron-how-to.html

The first thing to take on account is, not to use custom ESXi builds distributed by server manufacturers. We have found them to be very buggy, some of them plainly remove some ESXi features or basic design principles.

On the other side, you have to take on account that ESXi's cron service is not very refined, to put it mildly. You may need to reboot the server once you have installed it. So, what I would do is to:

- Install cron via the --install-cron argument.
- Check that the /etc/rc.local.d/local.sh file contains the line to push the xsibackup cron call into the /var/spool/cron/crontabs/root file.
- Reboot the server.
- Check that the /var/spool/cron/crontabs/root file contains the xsibackup-cron call.

If your cron file is still not working:

- Check that the crond service is loaded.
- Check that you have execute permissions on the xsibackup-cron file.

Offline

Board footer