Registered users
Linkedin Twitter Google+

In order to improve user's experience and to enable some functionalities by tracking the user accross the website, this website uses its own cookies and from third parties, like Google Analytics and other similar activity tracking software. Read the Privacy Policy
33HOPS, IT Consultants Download XSIBackup
33HOPS ::: Proveedores de Soluciones Informáticas :: Madrid :+34 91 930 98 66Avda. Castilla la Mancha, 95 - local posterior - 28700 S.S. de los Reyes - MADRID33HOPS, Sistemas de Informacion y Redes, S.L.Info
Alert icon This post applies to ©XSIBackup Free & Pro Classic, which have been deprecated. Consider changing to use ©XSIBackup-DC, which also offers a Pro version as an intermediate product.

<< Return to index

XSIBACKUP ::: Advanced cron: alternatives to xsibackup-cron

Take on account that since v. 11.0.0 (c)XSIBackup uses the ESXi crontab. This post was written to overcome some older (c)XSIBackup limitations when it would run on its own crontab.

You can nevertheless apply the same general concepts, should you want XSIBackup be run from some external centralized crontab.

Some users have more complex scheduling requirements than what can be achieved with a combination of weekday and time, this post is for them.

XSIBackup's crontab file (xsibackup-cron) is a way to schedule weekly backups, ranging from "once a week" to "every day" schedules. This covers the vast majority of user's needs and allows to keep cron programming simple. Nevertheless, there are cases in which some Sysadmin wants to configure a scheduled task that goes beyond what can be easily achieved with XSIBackup's default scheduling system.

Let's say that you want to configure a backup to be run every hour. It might be a small VM that we might want to backup or a OneDiff diff backup to keep a mirror VM in sync. In this particular scenarios performing an hourly backup may be perfectly feasible and reasonable. So, let's delve into the different options we have when we need to get out of the road.

You have basically two options to program more flexible schedules: one of them is to change XSIBackup's date mask to accomodate your needs, the second option is to use ESXi's root crontab directly.

1) Change XSIBackup's date mask:

XSIBackup uses time stamps in the form "Mon 13:23" that are matched against the same pattern for the current time. The xsibackup-cron file is called every minute from the ESXi's crontab at /var/spool/cron/crontabs/root and if any of the configured times is matched at any backup job line, then XSIBackup execution is performed. The [Day Of Week]+[Time] is coded into the string parsed to the date function (+"%a %H:%M"). To tweak this, you must change this string to any value supported by the Linux date function.

Once you have accomplished the above, just use the same mask to define --time in your xsibackup-cron file. Let's use an example to concrete the described procedure into something more tangible:

You may use the following date stamp: date +"%M" for the (*)NOW (Please, note that the asterisk sign is not part of the source code, just a way to highlight the NOW variable) variable, that will give you the minute of the hour. If you then configure your xsibackup-cron file to run a job with a --time argument like the one shown below, you will get your cron to execute the job every time the minutes of the hour are "00", and thus you'll be executing the job every hour on the "00" minute. You can use any minute from 00 to 59 to have your backup executed that minute every hour.

2) Use ESXi root crontab:

You can also use the ESXi's crontab to execute your XSIBackup jobs. This is fairly easy: first of all just test your backup job interactively and add it to a text file, you can name it however you want and you must place it in a persistent path. Future versions of XSIBackup will use the xsi-dir/conf/jobs as the steady path to store this kind of files, so please stick to it. We'll use the file xsi-dir/conf/jobs/my-backup.job, this file needs to be executable for the ESXi cron to be able to run it, so you'll need to change its permissions this way:

Once your backup job has been tested (you never know if a sequence of commands contains any errors until you test it) you can place it to the above file adding the additional argument --exec=yes at the end of the backup job line. This last argument is fundamental for the ESXi's cron to execute the job.

Now that you have the backup job ready to be triggered, just edit the ESXi's root crontab in the path /var/spool/cron/crontabs/root and add the job as you would do in any other Linux or Unix environment. ATENTION: please note that the /var/spool/cron/crontabs/root file does not have write permissions by default, so you will need to change them before editing it, otherwise you won't be able to save the modifications you make.
This page was last modified on 2019-05-07

Website Map
Resources & help
33HOPS Forum
Index of Docs

©33HOPS site relies on the following technologies and partners:
SSL Protocol PayPal Payment Gateway Stripe Payment Gateway

©33HOPS Sistemas de Información y Redes, S.L. | VAT No: ESB83583716 | Avda. Castilla la Mancha, 95, local posterior, 28701 San Sebastián e los Reyes (Madrid) Spain

Fill in to download
The download link will be sent to your e-mail.

            Read our Privacy Policy

(*) DC & Pro users, please login to your user area to download