#! /bin/bash echo "Backify is starting, looking for configuration file..." >&2 config='backup.cfg' config_secured='sbackup.cfg' if config -f "$config"; then echo "Configuration found." >&2 else exit fi if egrep -q -v '^#|^[^ ]*=[^;]*' "$config"; then echo "Config file is unclean, cleaning it..." >&2 egrep '^#|^[^ ]*=[^;&]*' "$config" > "$config_secured" config="$config_secured" fi source "$config" echo "Configuration file loaded" >&2 mkdir /tmp/backify-$(date +%Y%m%d_%H%M) tmpdir='/tmp/backify-$(date +%Y%m%d_%H%M)' if [ "$www_backup" = true ] then echo "Backing up wwwroot..." >&2 mkdir -p $tmpdir/wwwdata cp -r $www_dir/ $tmpdir/wwwdata/ echo "Finished" >&2 fi if [ "$vhost_backup" = true ] then echo "Backing up vhosts..." >&2 mkdir -p $tmpdir/vhosts cp -r $vhost_dir/ $tmpdir/vhosts/ echo "Finished" >&2 fi