Running a command when screen locks

I use this to fire off a cryptominer when my screen locks. Works on Fedora 26
I run this command as a batch file in screen. Could be made into a daemon i suppose but screen works good enough for now

dbus-monitor --session "type=signal,interface=org.gnome.ScreenSaver" |
while read MSG; do
 LOCK_STAT=`echo $MSG | grep boolean | awk '{print $2}'`
   if [[ "$LOCK_STAT" == "true" ]]; then
    echo "was locked"
    killall myfile
    screen -d -m /pathto/myfile -flags
   else
    echo "was un-locked"
    killall myfile
   fi
done

Compress a folder and send to to another server via SSH

This command will tar an entire folder, pass it to gzip then pass it to SSH which then in turn writes the resultant output to a file on a remote server
Useful for backing up small folders to remote servers
Dont forget to ssh-copy-id on the source server so password-less authentications works

tar -cvf - /var/log/httpd/ | /bin/gzip -c | /usr/bin/ssh root@1.1.1.1 'cat > /root/test.tar.gz'