Prune scripts post-backup giving Exec format error


#1

After backup:

2018-12-02 12:06:26.267774 INFO COMMAND_RUN Running command: /vmfs/volumes/5af9827b-7ba75a45-e078-2c768a4f7e44/verticalbackup/.verticalbackup/scripts/post-backup
2018-12-02 12:06:26.279685 INFO COMMAND_FAILURE Failed to run command '/vmfs/volumes/5af9827b-7ba75a45-e078-2c768a4f7e44/verticalbackup/.verticalbackup/scripts/post-backup': Exec format error
2018-12-02 12:06:26.279953 ERROR COMMAND_FAILURE Failed to run command '/vmfs/volumes/5af9827b-7ba75a45-e078-2c768a4f7e44/verticalbackup/.verticalbackup/scripts/post-backup': Exec format error
2018-12-02 12:06:28.277304 INFO EMAIL_SEND A notification email has been sent to admin@domain.com

when running manually it works

[root@localhost:/vmfs/volumes/5af9827b-7ba75a45-e078-2c768a4f7e44/verticalbackup] /vmfs/volumes/5af9827b-7ba75a45-e078-2c768a4f7e44/verticalbackup/.verticalbackup/scripts/post-backup

Vertical Backup 1.2.1
Storage set to sftp://yellowbp@10.10.0.52//mnt/vfs16T/yellowbp/backup-vm2
No previous fossil collections found
No backup has been selected for deletion

The post-backup script

 cat /vmfs/volumes/5af9827b-7ba75a45-e078-2c768a4f7e44/verticalbackup/.verticalbackup/scripts/post-backup

/vmfs/volumes/5af9827b-7ba75a45-e078-2c768a4f7e44/verticalbackup/vertical  prune -k 0:360 -k 30:180 -k 7:30 -k 1:7

Permission on file

-rwxr-xr-x    1 root     root           115 Nov 30 08:05 /vmfs/volumes/5af9827b-7ba75a45-e078-2c768a4f7e44/verticalbackup/.verticalbackup/scripts/post-backup

#2

That is because the account that the cron job ran as (usually root) may have a different shell than the normal user account. Adding #!/bin/bash or #!/bin/sh as the first line to the post-backup script should fix this issue.