Skip to content

Instantly share code, notes, and snippets.

@philroche
Created February 13, 2018 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philroche/54c9ecc29bd7ba02db54bcb66c654920 to your computer and use it in GitHub Desktop.
Save philroche/54c9ecc29bd7ba02db54bcb66c654920 to your computer and use it in GitHub Desktop.
Backup ZNC config and chat logs
#!/bin/bash
### Facultatif change :
DIR=/data/znc # This will most likely change for you
TAR_PATH=`whereis tar | cut -d ' ' -f 2`
p7zip_PATH=`whereis 7za | cut -d ' ' -f 2`
DATEI1=$(date +%Y-%m-%d)_znc_backup.tar
DATEI2=$(date +%Y-%m-%d)_znc_backup.tar.7z
DATUM=$(date +%Y-%m-%d)
sevenzp="a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on -mhe=on"
### no Change after here
if [ ! -d "$DIR" ]; then echo "You MUST change DIR variable. TAR. Visit: http://wiki.znc.in/index.php?title=ZNC_Backup"; exit 0; fi
if [ ! -x "$TAR_PATH" ]; then echo "You MUST change TAR_PATH variable. Or install TAR. Visit: http://wiki.znc.in/index.php?title=ZNC_Backup"; exit 0; fi
if [ ! -x "$p7zip_PATH" ]; then echo "You MUST change p7zip_PATH variable. Or install p7zip. Visit: http://wiki.znc.in/index.php?title=ZNC_Backup"; exit 0; fi
$TAR_PATH -cvf $DATEI1 $DIR
$p7zip_PATH $sevenzp $DATEI2 $DATEI1
rm -f $DATEI1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment