Merge branch 'master' of lab.maketank.net:hacking/spielplatz

This commit is contained in:
2021-01-11 19:20:48 +01:00
2 changed files with 6 additions and 2 deletions

View File

@@ -2,18 +2,19 @@
ping -c2 tumor.chaos 1>/dev/null || exit 0
CMD=$@
LOGDIR=/var/log/backup
DIR=/etc/duply
[[ -d $LOGDIR ]] || mkdir -p $LOGDIR
XUSER=$(who |grep :0 |cut -f 1 -d ' ')
XUID=$(id -u ${XUSER})
NOTIFYCMD="sudo -u ${XUSER} DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${XUID}/dbus /usr/bin/notify-send -c Backup -a duply"
NOTIFYCMD="su - ${XUSER} DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${XUID}/bus /usr/bin/notify-send -c Backup -a duply"
for I in ${DIR}/lenny*; do
BCKP=$(basename $I)
${NOTIFYCMD} ${BCKP} "Starting Backup..."
/usr/bin/duply $BCKP pre_incr_post 2&>1 >${LOGDIR}/${BCKP}.log;
/usr/bin/duply $BCKP ${CMD} 2&>1 >${LOGDIR}/${BCKP}.log;
FIN=$?
if [ $FIN -eq 0 ]; then
${NOTIFYCMD} --icon=sync-synchronizing ${BCKP} "Backup success."

3
mqtt/remove_retained_topic.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
echo "cleaning " $1 " :: usage: cleanmqtt <host> <topic>"
mosquitto_sub -h $1 -t "${2}/#" -v | while read line; do mosquitto_pub -h $1 -t "${line% *}" -r -n; done