Init flow
This commit is contained in:
commit
ebee9f5ffb
12
backup.cfg
Normal file
12
backup.cfg
Normal 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
39
main.sh
Normal 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
|
Loading…
Reference in New Issue
Block a user