Commit c5ca0ce5 authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

#4

parent d1c0164a
...@@ -38,22 +38,24 @@ function database_backup () ...@@ -38,22 +38,24 @@ function database_backup ()
function web_backup () function web_backup ()
{ {
if [[ -d /var/www ]]; then
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mWebsites backup" echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mWebsites backup"
for x in $(find $COPY_FROM -maxdepth 2 -name "web*" -type d -print0 | xargs -0) for x in $(find $COPY_FROM -maxdepth 2 -name "web*" -type d -print0 | xargs -0)
do do
tar -cpvzf $COPY_TO/$WEBBACKUPNAME-$(basename $x).tar.gz $x &> /dev/null tar -cpvzf $COPY_TO/$WEBBACKUPNAME-$(basename $x).tar.gz $x &> /dev/null
done; done;
fi
} }
function conf_backup () function conf_backup ()
{ {
/etc/init.d/scanbuttond stop [[ -f /etc/init.d/scanbuttond ]] && /etc/init.d/scanbuttond stop
/etc/init.d/vpnserver stop [[ -f /etc/init.d/vpnserver ]] && /etc/init.d/vpnserver stop
service transmission-daemon stop service transmission-daemon stop &> /dev/null
service tvheadend stop service tvheadend stop &> /dev/null
service cups stop service cups stop &> /dev/null
service samba stop service samba stop &> /dev/null
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mConf files backup" echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mConf files backup"
# find only existing # find only existing
filename=filelist.txt filename=filelist.txt
...@@ -65,24 +67,24 @@ function conf_backup () ...@@ -65,24 +67,24 @@ function conf_backup ()
[[ -f $next || -d $next ]] && echo "$next" >> $tmpfilename [[ -f $next || -d $next ]] && echo "$next" >> $tmpfilename
done done
tar cvPfz $COPY_TO/$FILEBACKUPNAME-allfiles.tgz -T $tmpfilename --exclude='*.sock' &> /dev/null tar cvPfz $COPY_TO/$FILEBACKUPNAME-allfiles.tgz -T $tmpfilename --exclude='*.sock' &> /dev/null
service samba start service samba start &> /dev/null
service cups start service cups start &> /dev/null
service tvheadend start service tvheadend start &> /dev/null
service transmission-daemon start service transmission-daemon start &> /dev/null
/etc/init.d/scanbuttond start [[ -f /etc/init.d/scanbuttond ]] && /etc/init.d/scanbuttond start
/etc/init.d/vpnserver start [[ -f /etc/init.d/vpnserver ]] && /etc/init.d/vpnserver start
} }
function mail_backup () function mail_backup ()
{ {
if [[ -d /var/vmail ]]; then if [[ -d /var/vmail ]]; then
service dovecot stop service dovecot stop &> /dev/null
service postfix stop service postfix stop &> /dev/null
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mMail backup" echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mMail backup"
tar cvPfz $COPY_TO/$FILEBACKUPNAME-mail.tgz /var/vmail tar cvPfz $COPY_TO/$FILEBACKUPNAME-mail.tgz /var/vmail
service postfix start service postfix start &> /dev/null
service dovecot start service dovecot start &> /dev/null
fi fi
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment