I searched the forum but i wasn't able to find an answer.
I want to schedule a backup job that needs to mount a temporary NFS filesystem, so i wrote a script that mounts, call xsibackup, and the unmount.
I would prefer to schedule that script into xsibackup-cron, instead o esxi cron, but i cannot figure how, can someone give me a working solution?
We can offer you some ideas, but you'll have to implement your working solution.
I guess your script carries all the logic: mount NFS, xsibackup and unmount NFS. Provided that you have tested your script and it's working, the only thing left to do is scheduling, right?
You then have multiple choices:
1 - ESXi cron, as you said, this is cumbersome to implement, as the ESXi crontab is not persistent, god knows why.
2 - Use an external Linux cron. When I say external I mean external to ESXi, but this could very well be a VM in the same ESXi host. Just exchange keys manually and program an SSH call to your script. Do not forget to use -t(t) SSH's option and/ or nohup as needed. You have a guide here: https://33hops.com/xsibackup-cron-how-to.html
3 - Use XSIBackup cron. It has not been designed to call bash scripts, it calls itself, but as XSIBackup will keep on rolling, no matter what errors it encounters, you just need to call XSIBackup with a malformed job syntax, like no --backup-point, and then use the [https://33hops.com/xsibackup-help-man-page.html#onerror]--on-error[/url] and [https://33hops.com/xsibackup-help-man-page.html#onsuccess]--on-success[/url] options to run your script.
4 - I can think of a fourth option, which is use a Windows command line SSH client, like plink.exe bundled with Putty. Create a batch, VB Script or Power Shell script (a batch is more than enough for the case) that runs your remote script and finally add your local Windows script to your task manager. Other Windows options are using CygWin (https://www.cygwin.com/) or the embeded Windows 10 Linux Shell (https://www.howtogeek.com/249966/how-to … indows-10/)
AH AH, the third option was the first I considered, but as it seemed the uglyest, I discarded it, but i will try, thanks.
There's a much more slick solution, which we overlooked. In fact we've been about to add it to the skeleton xsibackup-cron file a number of times and we forgot, we'll add it today, so that it is available with next version.
The xsibackup-cron file is a bash file, which is called every minute from the ESXi crontab. You can't add there whatever you want, cause it would execute each minute, but that has a simple solution.
if [ "$(date --date="2018-03-16 16:33" +%Y-%m-%d'T'%H':'%M )" == "$(date +%Y-%m-%d'T'%H':'%M )" ] then echo BINGO!! fi
By using this simple technique, you can program whatever other task and the crontab will be persistent across reboots.