diff --git a/backups/backup_dokuwiki.sh b/backups/backup_dokuwiki.sh new file mode 100644 index 0000000..5a4d9bc --- /dev/null +++ b/backups/backup_dokuwiki.sh @@ -0,0 +1,37 @@ +#/bin/bash +#docker config colder +docker_conf=/home/bsncubed/docker +now=$( date '+%F_%H%M%S' ) +cd $docker_conf +#remove old temp files +rm /tmp/dokuwiki_*.tar.gz +docker stop dokuwiki +tar cvzf /tmp/dokuwiki_$now.tar.gz dokuwiki +#tar error reporting +if [ $? -eq 0 ] +then + echo "send succsess" +else + curl -H "Content-Type: application/json" -d '{"content":"Dokuwiki backup **DID NOT COMPLETE**. It was at **Tar**","embeds":null,"username":"Dr Backup","avatar_url":"PIC URL","attachments":[]}' "DISCORD WEBHOOK" + exit +fi + +rsync -a /tmp/dokuwiki_$now.tar.gz moria.s0.is:backup_drive/Ben/dokuwiki +#rsync error reporting +if [ $? -eq 0 ] +then + echo "send succsessed" +else + curl -H "Content-Type: application/json" -d '{"content":"Dokuwiki backup **DID NOT COMPLETE** . It was at **rsync**","embeds":null,"username":"Dr Backup","avatar_url":"PIC URL","attachments":[]}' "DISCORD WEBHOOK" + exit +fi + +cd dokuwiki +docker compose up -d +if [ $? -eq 0 ] +then + curl -H "Content-Type: application/json" -d '{"content":"Dokuwiki backup completed sucsesfully <@264643868081782795>","embeds":null,"username":"Dr Backup","avatar_url":"PIC URL","attachments":[]}' "DISCORD WEBHOOK" +else + curl -H "Content-Type: application/json" -d '{"content":"Dokuwiki backup **DID NOT COMPLETE** <@264643868081782795>. It was at **docker**","embeds":null,"username":"Dr Backup","avatar_url":"PIC URL","attachments":[]}' "DISCORD WEBHOOK" + exit +fi