From c759f7939fe10155368e2b5f6f241bb680d58fab Mon Sep 17 00:00:00 2001 From: Bob Mottram <bob@freedombone.net> Date: Fri, 22 Sep 2017 18:03:54 +0100 Subject: [PATCH] Don't trigger usb canary if recently rebooted --- src/freedombone-usb-canary | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/freedombone-usb-canary b/src/freedombone-usb-canary index 9d380f33..f641687d 100755 --- a/src/freedombone-usb-canary +++ b/src/freedombone-usb-canary @@ -2,10 +2,13 @@ PROJECT_NAME=freedombone -ADMIN_USER=$(cat /root/${PROJECT_NAME}-completed.txt | grep 'Admin user' | awk -F ':' '{print $2}') -#MY_EMAIL_ADDRESS=${ADMIN_USER}@$(cat /etc/hostname) -MY_EMAIL_ADDRESS=root@$(cat /etc/hostname) -echo "USB device connected on ${DEVPATH}" | mail -s "${PROJECT_NAME} USB canary" ${MY_EMAIL_ADDRESS} -echo "${ACTION}" > /tmp/usb-canary -echo "${MY_EMAIL_ADDRESS}" >> /tmp/usb-canary -echo "$(date)" >> /tmp/usb-canary +UPTIME=$(cat /proc/uptime | awk -F '.' '{print $1}') +if [ $UPTIME -gt 120 ]; then + ADMIN_USER=$(cat /root/${PROJECT_NAME}-completed.txt | grep 'Admin user' | awk -F ':' '{print $2}') + #MY_EMAIL_ADDRESS=${ADMIN_USER}@$(cat /etc/hostname) + MY_EMAIL_ADDRESS=root@$(cat /etc/hostname) + echo "USB device connected on ${DEVPATH}" | mail -s "${PROJECT_NAME} USB canary" ${MY_EMAIL_ADDRESS} + echo "${ACTION}" > /tmp/usb-canary + echo "${MY_EMAIL_ADDRESS}" >> /tmp/usb-canary + echo "$(date)" >> /tmp/usb-canary +fi