[fix] Sudo on some backup script

This commit is contained in:
zamentur 2015-10-03 20:41:37 +02:00
parent c3bb11a4c6
commit 98e92bdbac
10 changed files with 17 additions and 13 deletions

View file

@ -1,5 +1,5 @@
backup_dir="$1/conf/ldap" backup_dir="$1/conf/ldap"
mkdir -p $backup_dir sudo mkdir -p $backup_dir
# Fix for first jessie yunohost where slapd.conf is called slapd-yuno.conf # Fix for first jessie yunohost where slapd.conf is called slapd-yuno.conf
# without slapcat doesn't work # without slapcat doesn't work
@ -11,5 +11,5 @@ fi
sudo cp -a /etc/ldap/slapd.conf $backup_dir/ sudo cp -a /etc/ldap/slapd.conf $backup_dir/
sudo slapcat -l $backup_dir/slapcat.ldif.raw sudo slapcat -l $backup_dir/slapcat.ldif.raw
egrep -v "^entryCSN:" < $backup_dir/slapcat.ldif.raw > $backup_dir/slapcat.ldif sudo bash -c "egrep -v '^entryCSN:' < $backup_dir/slapcat.ldif.raw > $backup_dir/slapcat.ldif"
rm -f $backup_dir/slapcat.ldif.raw sudo rm -f $backup_dir/slapcat.ldif.raw

View file

@ -1,4 +1,8 @@
backup_dir="$1/conf/ssh" backup_dir="$1/conf/ssh"
mkdir -p $backup_dir sudo mkdir -p $backup_dir
sudo cp -a /etc/ssh/. $backup_dir if [ -d /etc/ssh/ ]; then
sudo cp -a /etc/ssh/. $backup_dir
else
echo "SSH is not installed"
fi

View file

@ -1,4 +1,4 @@
backup_dir="$1/conf/ynh/mysql" backup_dir="$1/conf/ynh/mysql"
mkdir -p $backup_dir sudo mkdir -p $backup_dir
sudo cp -a /etc/yunohost/mysql $backup_dir/ sudo cp -a /etc/yunohost/mysql $backup_dir/

View file

@ -1,4 +1,4 @@
backup_dir="$1/conf/ssowat" backup_dir="$1/conf/ssowat"
mkdir -p $backup_dir sudo mkdir -p $backup_dir
sudo cp -a /etc/ssowat/. $backup_dir sudo cp -a /etc/ssowat/. $backup_dir

View file

@ -1,5 +1,5 @@
backup_dir="$1/data/home" backup_dir="$1/data/home"
mkdir -p $backup_dir sudo mkdir -p $backup_dir
. /usr/share/yunohost/apps/helpers . /usr/share/yunohost/apps/helpers

View file

@ -1,4 +1,4 @@
backup_dir="$1/conf/ynh/firewall" backup_dir="$1/conf/ynh/firewall"
mkdir -p $backup_dir sudo mkdir -p $backup_dir
sudo cp -a /etc/yunohost/firewall* $backup_dir sudo cp -a /etc/yunohost/firewall* $backup_dir

View file

@ -1,4 +1,4 @@
backup_dir="$1/conf/ynh/certs" backup_dir="$1/conf/ynh/certs"
mkdir -p $backup_dir sudo mkdir -p $backup_dir
sudo cp -a /etc/yunohost/certs/. $backup_dir sudo cp -a /etc/yunohost/certs/. $backup_dir

View file

@ -1,5 +1,5 @@
backup_dir="$1/conf/xmpp" backup_dir="$1/conf/xmpp"
mkdir -p $backup_dir/{etc,var} sudo mkdir -p $backup_dir/{etc,var}
sudo cp -a /etc/metronome/. $backup_dir/etc sudo cp -a /etc/metronome/. $backup_dir/etc
sudo cp -a /var/lib/metronome/. $backup_dir/var sudo cp -a /var/lib/metronome/. $backup_dir/var

View file

@ -1,4 +1,4 @@
backup_dir="$1/conf/nginx" backup_dir="$1/conf/nginx"
mkdir -p $backup_dir sudo mkdir -p $backup_dir
sudo cp -a /etc/nginx/conf.d/. $backup_dir sudo cp -a /etc/nginx/conf.d/. $backup_dir

View file

@ -1,4 +1,4 @@
backup_dir="$1/conf/cron" backup_dir="$1/conf/cron"
mkdir -p $backup_dir sudo mkdir -p $backup_dir
sudo cp -a /etc/cron.d/yunohost* $backup_dir/ sudo cp -a /etc/cron.d/yunohost* $backup_dir/