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:
pre-and-post-script-for-veeam.sh
systemctl stop myservice
systemctl stop mongod
exit 0and
pre_and_post_veeam_post.sh
systemctl start mongod
systemctl start myservice
exit 0I highly recommend proper error handling - here handover error codes from systemctl commands.
Select the path to the shell scripts like this:

If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow