Init flow

This commit is contained in:
David Petric 2023-02-10 14:49:35 +01:00
commit ebee9f5ffb
2 changed files with 51 additions and 0 deletions

12
backup.cfg Normal file
View File

@ -0,0 +1,12 @@
#Backup wwwroot ?
www_backup=false
#wwwroot location
www_dir='xyz'
#Backup vhost config ?
vhost_backup=false
#Vhost location
vhost_dir='/etc/httpd/sites-enabled'
#Docker
#Docker volumes
#Syslogs
#Rsync

39
main.sh Normal file
View File

@ -0,0 +1,39 @@
#! /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