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

Forum ©XSIBackup: ©VMWare ©ESXi Backup Software


You are not logged in.

#1 2017-06-15 07:32:00

kevin
Member
Registered: 2017-06-15
Posts: 4

Dont run from crond job

Hello,
I use ESXi 6.0 and xsibackup free 9.0.2


I start my backup from a script launched by crond.

The script run fine ( i use date > /var/log/backup.log to assure that ).

The command i run is :
/vmfs/volumes/disk/xsi-dir/xsibackup --backup-point=/vmfs/volumes/nfs/LAST --backup-type=custom --backup-vms=vm1,vm2,vm3

When i run this from shell, the command execute fine.

When the same line is executed by the script launched by crond it just dont do anything, so no backup.

Thank you for your help

Offline

#2 2017-06-15 17:46:07

Daniel
Guest

Re: Dont run from crond job

Add your backup job to the xsibackup-cron file as explained here
Use the (c)XSIBackup Cron

Or run your script directly from the ESXi crontab
Run from the (c)ESXi crontab

Last edited by Daniel (2017-06-23 14:32:21)

#3 2017-06-16 06:47:44

kevin
Member
Registered: 2017-06-15
Posts: 4

Re: Dont run from crond job

Hello,

Daniel wrote:

Or run your script directly from the ESXi crontab
Run directly from the (c)ESXi crontab

This is what i do.
My script runs well (i do log to a file from it), but when it comes to the xsibackup command, nothing append.

Couldn't log what happens because :
   xsibackup >> stdout.txt
give a big nothing.

Offline

#4 2017-06-23 11:27:22

kevin
Member
Registered: 2017-06-15
Posts: 4

Re: Dont run from crond job

I solved the issue by myself, needed to add a preparation script to cron job, and exec backup with the xsibackup-cron file.
I think this is not the normal behavior because it break common unix/linux usage of cron.
Don't get me wrong, i really like xsibackup, but this single thing look wrong to me.

Offline

#5 2017-06-23 14:31:39

roberto
Moderator
Registered: 2017-04-22
Posts: 49

Re: Dont run from crond job

I really don't know what was happening to you, but it has to be some sort of missunderstanding, or something you asume works in a different way. There are thousands of XSIBackup users, we launch cron jobs every day, and although some people have had trouble with hanged crond services, nobody ever reported this issue.

Offline

#6 2017-07-27 11:12:26

plaurent
Member
Registered: 2017-07-27
Posts: 2

Re: Dont run from crond job

Kevin, what preparation script are you using? I also have a shell script that executes a number of actions (like shutting down a related machine to the one being backed up, etc) and then running xsibackup. It simply refuses to run via cron, even though it runs fine at the prompt.

Offline

#7 2017-07-27 16:32:44

roberto
Moderator
Registered: 2017-04-22
Posts: 49

Re: Dont run from crond job

We offer a working solution: xsibackup-cron, you can use it to trigger your backups and even other scripts.

You cannot assume ESXi is Linux and that things will work as you expect. ESXi is not Linux, thus thoughts as Kevin's "normal behavior", just don't apply in this case. ESXi is somewhat resembling Linux, with an extremely cut down shell and with strategically situated bugs as well as reduced functionality in every component.

I'll borrow Niki Lauda's famous quote to say: programming scripts under ESXi is like piloting a helicopter in a telephone box. So, follow our advice or put your helmet on.

I'm not saying you can't do it, there's a lot of really smart people around this forum, but fighting against ESXi's Linux false resemblance will require a lot of time and will from your part. Thus, if you are a backup professional that just wants to set thing up, I would not bother; follow our advice or even buy our PRO version to support our efforts.

Last edited by roberto (2017-07-27 16:33:38)

Offline

#8 2017-07-27 19:31:37

plaurent
Member
Registered: 2017-07-27
Posts: 2

Re: Dont run from crond job

Actually, I have purchased your PRO version and am using that. What I'm trying to achieve is to run the backup script that I have from a remote cron on the backup server itself (ssh root@esxiserver "/blah/blah/backups.sh") for various reasons outside of the scope of this topic. Sooo... perhaps instead of embedding the xsibackup routine into my backup script (which includes a couple of /bin/vim-cmd vmsvc/power.on and off - it shuts down another machine, not the one being backed up), I should include the vim-cmd in the xsibackup-cron job instead.

I'll try that.

Offline

#9 2017-07-27 21:35:44

roberto
Moderator
Registered: 2017-04-22
Posts: 49

Re: Dont run from crond job

### 2017-08-03 Admin update ###

To trigger scripts from an outer system by using OpenSSH client use the -t SSH option to redirect output to your client.

https://33hops.com/xsibackup-remote-execution.html

### 2017-08-03 Admin update ###

Mmm, I don't know if I'm getting you right. If you want to execute a backup job (./xsibackup --backup-program --backup-type=custom...) from a remote cron:

1 - You need to make sure your remote Linux system can run SSH commands passwordlessly. Add your Linux cron system's (the system from where you want to execute the job) rsa pub key to the authorized_keys file at the ESXi server where the job is to be executed. Don't have an RSA key pair?, first of all generate one, how?, by using OpenSSL binary https://en.wikibooks.org/wiki/Cryptogra … ng_OpenSSL

2 - Run the job manually

ssh -vv -o StrictHostKeyChecking=no -i /path/to/your/key/xsibackup_id_rsa root@your.esxihost.com "/vmfs/volumes/datastore1/xsi-dir/xsibackup backup-job"

with the -vvv (verbose) option to actually see what's being sent to the ESXi host, as some characters will for sure need to be escaped.

3 - Once you have verified that the command gets to the server as it should, whithout any unescaped characters that might break its syntax coherence, add it to your root crontab: /etc/crontab at the triggering Linux box. Avoid using crontab -e and use /etc/crontab directly to be more straight and avoid security blockings.

Last edited by roberto (2017-07-30 19:35:24)

Offline

#10 2018-06-28 06:27:09

kevin
Member
Registered: 2017-06-15
Posts: 4

Re: Dont run from crond job

Hello,
Happy to see with this morning newsletter :

" Now the XSIBackup cron system is fully integrated with the ESXi crond service, so jobs are directly executed by the
  crond daemon. You can schedule jobs with all the flexibility of a classic Linux crontab."

Thank you for your work on this smile

Last edited by kevin (2018-06-28 06:37:00)

Offline

Board footer