bugfixes rsnapshot/anacron
This commit is contained in:
parent
b88f1f3566
commit
0d00dd91da
2 changed files with 8 additions and 10 deletions
16
rsnapshot_anacron/install.sh
Normal file → Executable file
16
rsnapshot_anacron/install.sh
Normal file → Executable file
|
|
@ -7,21 +7,21 @@ set -euo pipefail
|
||||||
|
|
||||||
user="$USER"
|
user="$USER"
|
||||||
|
|
||||||
mkdir -p $user/scripts
|
mkdir -p $HOME/scripts
|
||||||
cp -r ../anacron $user/scripts/
|
cp -r ../rsnapshot_anacron $HOME/scripts/
|
||||||
cd $user/scripts/
|
cd $HOME/scripts/rsnapshot_anacron/
|
||||||
|
|
||||||
base="$(pwd)"
|
base="$(pwd)"
|
||||||
|
|
||||||
# Check installed packages
|
# Check installed packages
|
||||||
installed="$(dpkg -l rsnapshot)|grep '^ii\srsnapshot\s'"
|
installed="$(dpkg -l rsnapshot)|grep '^ii\srsnapshot\s'"
|
||||||
if [[ "$sintalled" == "" ]]; then
|
if [[ "$installed" == "" ]]; then
|
||||||
echo "rsnapshot is not installed"
|
echo "rsnapshot is not installed"
|
||||||
echo "You should install it and edit /etc/rsnapshot.conf:"
|
echo "You should install it and edit /etc/rsnapshot.conf:"
|
||||||
echo "sudo apt install rsnapshot anacron && sudo gvim /etc/rsnapshot.conf"
|
echo "sudo apt install rsnapshot anacron && sudo gvim /etc/rsnapshot.conf"
|
||||||
exit 100
|
exit 100
|
||||||
fi
|
fi
|
||||||
sudo install anacron
|
sudo apt install anacron
|
||||||
|
|
||||||
|
|
||||||
snapshot=$(grep "^snapshot_root.*$" /etc/rsnapshot.conf|cut -f 2)
|
snapshot=$(grep "^snapshot_root.*$" /etc/rsnapshot.conf|cut -f 2)
|
||||||
|
|
@ -33,7 +33,7 @@ fi
|
||||||
|
|
||||||
tag="=^=rsnapshot_anacron=^="
|
tag="=^=rsnapshot_anacron=^="
|
||||||
if [[ $(grep "$tag" /etc/anacrontab) == "" ]]; then
|
if [[ $(grep "$tag" /etc/anacrontab) == "" ]]; then
|
||||||
sudo echo "
|
echo "
|
||||||
##########################################################
|
##########################################################
|
||||||
# $tag
|
# $tag
|
||||||
# périodicité (jours),
|
# périodicité (jours),
|
||||||
|
|
@ -44,11 +44,9 @@ sudo echo "
|
||||||
@daily 10 backup.daily sudo -u $user run-parts $base/daily/
|
@daily 10 backup.daily sudo -u $user run-parts $base/daily/
|
||||||
@weekly 10 backup.weekly sudo -u $user run-parts $base/weekly/
|
@weekly 10 backup.weekly sudo -u $user run-parts $base/weekly/
|
||||||
@monthly 10 backup.monthly sudo -u $user run-parts $base/monthly/
|
@monthly 10 backup.monthly sudo -u $user run-parts $base/monthly/
|
||||||
" >> /etc/anacrontab
|
" | sudo tee -a /etc/anacrontab
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -s $base ~/.anacron
|
|
||||||
|
|
||||||
# Test if snapshot dir is set
|
# Test if snapshot dir is set
|
||||||
source $base/rsnapshot_common
|
source $base/rsnapshot_common
|
||||||
if [[ "$SNAPSHOT_ROOT" == "<NOT_DEFINED>" ]] ; then
|
if [[ "$SNAPSHOT_ROOT" == "<NOT_DEFINED>" ]] ; then
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ ENABLE_CRON=no
|
||||||
#
|
#
|
||||||
SNAPSHOT_ROOT="<NOT_DEFINED>"
|
SNAPSHOT_ROOT="<NOT_DEFINED>"
|
||||||
|
|
||||||
RSNAPSHOT="/usr/bin/rsnapshot -t"
|
RSNAPSHOT="/usr/bin/rsnapshot"
|
||||||
|
|
||||||
function backup()
|
function backup()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue