#!/bin/bash
service=*REPLACE WITH SERVICE*
DATE=`date +%m-%y`
dir=`pwd`
if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0)); then
echo "$service is running, terminating..."
killall $service
else
echo "$service is not running..."
fi
echo "starting backup..."
tar -pzcf backup_$DATE.tar.gz /*REPLACE WITH DIR*/
echo "backup done, checking integrety"
tar -tvf $dir/backup_$DATE.tar.gz
echo "All done. please review integrety output to make sure everything went smoothly"
#!/bin/bash
# This script will stop SecurityCenter
# create a TAR ball of the /opt/sc dir
# Then start SC again.
service=SecurityCenter
if ($(service $service status | grep -v grep | grep running | wc -l) >0 ); then
echo "$service is running, stopping it"
service $service stop
service $service status | grep Active
else
echo "$service is not running, continuing."
fi
echo "starting backup..."
tar -pzcf sc_backup.tar.gz /opt/sc
echo "Backup finished, starting $service"
service $service start
service $service status | grep Active