Add webserver-backup

this might be broken, the actual script doas not include weewx backups...
main
Dominic Reich 9 months ago committed by Gitea (OE7DRT git repos)
parent df157e6adb
commit 4364ee3a31
No known key found for this signature in database
GPG Key ID: 8CD13F96FB7C0465

@ -0,0 +1,49 @@
#!/bin/sh
#
# running on the rootserver that serves weewx and cloudlog for now
# running WeeWX and MariaDB
# will soon fetch and include webcam pics from ESP32-CAM
# Author: Dominic Reich <dominic{at}oe7drt.com>
# License: MIT
SQLDATE=$(date +%F-%R)
WX_CONFIG=/home/weewx/weewx.conf
WX_SKINCONF=/home/weewx/skins/neowx-material/skin.conf
CL_CONFIG=/var/www/sites/cloudlog/application/config/config.php
CL_DBCONF=/var/www/sites/cloudlog/application/config/database.php
WX_OUTFILE=/tmp/weewx-backup-${SQLDATE}.sql
CL_OUTFILE=/tmp/cloudlog-backup-${SQLDATE}.sql
DATE=$(date "+%A, %d. %B %Y")
CLOCK=$(date "+%H:%M")
mysqldump -u weewx -p{password} weewx > ${WX_OUTFILE}
mysqldump -u cloudlog -p{password} cloudlog > ${CL_OUTFILE}
#echo testfile_weewx > ${WX_OUTFILE}
xz ${WX_OUTFILE}
xz ${CL_OUTFILE}
echo '''Attached files are
- Database backups
`'''${WX_OUTFILE}'''`
`'''${CL_OUTFILE}'''`
- WeeWX configuration file
`'''${WX_CONFIG}'''`
- neowx-material skin configuration file
`'''${WX_SKINCONF}'''`
- Cloudlog configuration files
`'''${CL_CONFIG}'''`
`'''${CL_DBCONF}'''`
This mail was sent out on '''${DATE}''' at '''${CLOCK}'''.
--
Don'''\''''t ever think on replying to this mail address!
You'''\''''d be just ignored...''' | neomutt -s "Server backup from `date +\"%F %R\"`" \
-a ${WX_OUTFILE}.xz ${WX_CONFIG} ${WX_SKINCONF} ${CL_OUTFILE}.xz ${CL_CONFIG} ${CL_DBCONF} -- {email}
rm -f ${WX_OUTFILE}.xz ${CL_OUTFILE}.xz
Loading…
Cancel
Save