pre and post script for veeam MongoDB backups

Create an pre.sh and post.sh script to be run before and after a veeam backup of your ubuntu machine runs and will shutdown MongoDB and your webservice (myservice) using the MongoDB before the backup and start it again after the backup has finished. For example:

systemctl stop myservice
systemctl stop mongod
exit 0

and

systemctl start mongod
systemctl start myservice
exit 0

I highly recommend proper error handling – here handover error codes from systemctl commands.

Select the path to the shell scripts like this:
veeam job setup enable scripts