Bunch of changes; renaming the ConfigBackup; you kinda suck
This commit is contained in:
23
Kumonoboru
23
Kumonoboru
@@ -1,7 +1,9 @@
|
||||
#!/bin/bash
|
||||
##Simple script to run Restic backups
|
||||
source $SCRIPTS/Okiru
|
||||
source /root/.bash_profile
|
||||
source /home/shmick/Scripts/Okiru
|
||||
source /etc/environment
|
||||
export HOME=/root/
|
||||
arg0=$(basename "$0")
|
||||
#Show help if arguments are misused
|
||||
usage()
|
||||
@@ -26,9 +28,9 @@ help()
|
||||
echo " {-l|--limit} #[Kbps] -- Limit upload & download speed"
|
||||
echo " {-h|--help} -- Print this help message and exit"
|
||||
echo "Available repositories:"
|
||||
echo "Gerbil-TK Photos (path: /Red-Vol/Media/Pictures)"
|
||||
echo "Pukeko-XYZ-Containers Containers (path: /Red-Vol/Media/Containers)"
|
||||
echo "Pukeko-XYZ-Cloud Data from all devices (path: /Red-Vol/Media/Cloud/Syncthing)"
|
||||
echo "Gerbil-TK Photos (path: /var/Red-Vol/Media/Pictures)"
|
||||
echo "Pukeko-XYZ-Containers Containers (path: /var/Red-Vol/Media/Containers)"
|
||||
echo "Pukeko-XYZ-Cloud Data from all devices (path: /var/Red-Vol/Media/Cloud/Syncthing)"
|
||||
exit 0
|
||||
}
|
||||
#Pass arguments to the script
|
||||
@@ -135,22 +137,22 @@ clean(){
|
||||
if [[ -n $REPOSITORY ]] && [[ -z $CLEAN ]]; then
|
||||
case "$REPOSITORY" in
|
||||
(Gerbil-TK)
|
||||
backup Gerbil-TK /Red-Vol/Media/Pictures/
|
||||
backup Gerbil-TK /var/Red-Vol/Media/Pictures/
|
||||
;;
|
||||
(Pukeko-XYZ-Containers)
|
||||
backup Pukeko-XYZ-Containers /Red-Vol/Media/Containers
|
||||
backup Pukeko-XYZ-Containers /var/Red-Vol/Media/Containers
|
||||
;;
|
||||
(Pukeko-XYZ-Cloud)
|
||||
backup Pukeko-XYZ-Cloud /Red-Vol/Media/Cloud/Syncthing
|
||||
backup Pukeko-XYZ-Cloud /var/Red-Vol/Media/Cloud/Syncthing
|
||||
;;
|
||||
(*)
|
||||
help;;
|
||||
esac
|
||||
#If cleaning was not forced, backup the repositories
|
||||
elif [[ -z $CLEAN ]]; then
|
||||
backup Gerbil-TK /Red-Vol/Media/Pictures/
|
||||
backup Pukeko-XYZ-Containers /Red-Vol/Media/Containers
|
||||
backup Pukeko-XYZ-Cloud /Red-Vol/Media/Cloud/Syncthing
|
||||
backup Gerbil-TK /var/Red-Vol/Media/Pictures/
|
||||
backup Pukeko-XYZ-Containers /var/Red-Vol/Media/Containers
|
||||
backup Pukeko-XYZ-Cloud /var/Red-Vol/Media/Cloud/Syncthing
|
||||
#If a specific repository was requested to be cleaned, clean it
|
||||
elif [[ -n $REPOSITORY ]] && [[ -n $CLEAN ]]; then
|
||||
case "$REPOSITORY" in
|
||||
@@ -174,3 +176,4 @@ elif [[ -n $CLEAN ]] || [[ $(date +%a) == "Friday" ]]; then
|
||||
fi
|
||||
#Wrap up this run's log and report nicely
|
||||
end_logging
|
||||
exit 0
|
||||
|
||||
@@ -39,14 +39,20 @@ elif [[ ! -f "$1" ]]; then
|
||||
fi
|
||||
}
|
||||
#Configuration files to sync
|
||||
conf_sync /etc/ddclient.conf $CONF_DIR
|
||||
for tab in $(ls /var/spool/cron/tabs/*); do
|
||||
conf_sync $tab
|
||||
done
|
||||
conf_sync /etc/docker/daemon.json
|
||||
conf_sync /etc/environment
|
||||
conf_sync /etc/fstab
|
||||
conf_sync /etc/hosts
|
||||
conf_sync /etc/postfix/main.cf
|
||||
conf_sync /etc/anacrontab
|
||||
|
||||
conf_sync /etc/profile
|
||||
for conf in $(ls /etc/snapper/configs/* 2> /dev/null); do
|
||||
conf_sync $conf
|
||||
done
|
||||
for conf in $(ls /etc/systemd/system/murchison*); do
|
||||
conf_sync $conf
|
||||
done
|
||||
for conf in $(ls /etc/systemd/system/kumonoboru*); do
|
||||
conf_sync $conf
|
||||
done
|
||||
#Fix permissions
|
||||
chown -R shmick $CONF_DIR
|
||||
10
Okiru
10
Okiru
@@ -78,21 +78,21 @@ logging () {
|
||||
}
|
||||
#Debugging level logging; can be toggled via a switch
|
||||
debug () {
|
||||
printf "${BLUE}[DEBUG]: $1${STOP}\n" > /dev/stdout
|
||||
printf "${BLUE}[DEBUG]: $1${STOP}\n"
|
||||
if [[ -f $LOG ]]; then
|
||||
echo -e "$(date | awk '{print $4}') [DEBUG]: $1" >> $LOG
|
||||
fi
|
||||
}
|
||||
#Information level logging;
|
||||
info () {
|
||||
printf "${CYAN}[INFO]:${STOP} $1\n" > /dev/stdout
|
||||
printf "${CYAN}[INFO]:${STOP} $1\n"
|
||||
if [[ -f $LOG ]]; then
|
||||
echo -e "$(date | awk '{print $4}') [INFO]: $1" >> $LOG
|
||||
fi
|
||||
}
|
||||
#Warning level logging;
|
||||
warn () {
|
||||
printf "${YELLOW}[WARNING]:${STOP} $1\n" > /dev/stdout
|
||||
printf "${YELLOW}[WARNING]:${STOP} $1\n"
|
||||
if [[ -f $LOG ]]; then
|
||||
echo -e "$(date | awk '{print $4}') [WARN]: $1" >> $LOG
|
||||
fi
|
||||
@@ -101,7 +101,7 @@ warn () {
|
||||
error () {
|
||||
echo $1 1>&2
|
||||
# ` ^ Output error message to stderr
|
||||
printf "${RED}[ERROR]: $1${STOP}\n" > /dev/stdout
|
||||
printf "${RED}[ERROR]: $1${STOP}\n"
|
||||
# ^ Print it to the screen
|
||||
errors+=("$1")
|
||||
# ^ And add to errors array
|
||||
@@ -116,7 +116,7 @@ error () {
|
||||
return 1
|
||||
}
|
||||
ok () {
|
||||
printf "${GREEN}[SUCCESS]: $1${STOP}\n" > /dev/stdout
|
||||
printf "${GREEN}[SUCCESS]: $1${STOP}\n"
|
||||
if [[ -f $LOG ]]; then
|
||||
echo -e "$(date | awk '{print $4}') [SUCCESS]: $1" >> $LOG
|
||||
fi
|
||||
|
||||
@@ -17,4 +17,4 @@ else
|
||||
# ^ If connection is established, use local DNS
|
||||
fi
|
||||
#Force update of DNS resolution
|
||||
netconfig update -f
|
||||
/sbin/netconfig update -f
|
||||
|
||||
Reference in New Issue
Block a user