If you need always want to backup the datastores and restart the EMS server with -forceStart option. You could try the following solution.
1. rename the tibemsd to tibemsd_real.
2. Create the tibemsd script as the following. The following script backs up all datastores before starting the server with -forceStart and also discards old backups, in this particular instance those older than a day.
---
#!/bin/bash
# Set DATASTORE_PATH to the directory where EMS datastores are located.
DATASTORE_PATH=/ems_share/datastore
BACKUP=$DATASTORE_PATH-`hostname`-`date +"%Y%m%d%H%M%S%N"`.tar.gz
echo "##########"
echo Removing backed up datastores older than a day:
find $DATASTORE_PATH*.tar.gz -mtime +1 -exec ls -l {} \; -exec rm {} \;
echo Backing up all datastores into $BACKUP
cd $DATASTORE_PATH
tar -czf $BACKUP *
cd - >/dev/null
echo Starting tibemsd_real -forceStart "$@"
echo "##########"
tibemsd_real -forceStart "$@"
---
3. chmod 755 tibemsd
Please feel free to tailor the script to suit your needs, in particular regarding how to discard old datastore backups.
!! When you upgrade your ems server, you need to rename the tibemsd to tibemsd_real again.