Bläddra i källkod

Merge branch 'stretch' of https://github.com/bashrc/freedombone

Bob Mottram 7 år sedan
förälder
incheckning
557d3c4cd5
1 ändrade filer med 10 tillägg och 7 borttagningar
  1. 10
    7
      src/freedombone-usb-canary

+ 10
- 7
src/freedombone-usb-canary Visa fil

@@ -2,10 +2,13 @@
2 2
 
3 3
 PROJECT_NAME=freedombone
4 4
 
5
-ADMIN_USER=$(cat /root/${PROJECT_NAME}-completed.txt | grep 'Admin user' | awk -F ':' '{print $2}')
6
-#MY_EMAIL_ADDRESS=${ADMIN_USER}@$(cat /etc/hostname)
7
-MY_EMAIL_ADDRESS=root@$(cat /etc/hostname)
8
-echo "USB device connected on ${DEVPATH}" | mail -s "${PROJECT_NAME} USB canary" ${MY_EMAIL_ADDRESS}
9
-echo "${ACTION}" > /tmp/usb-canary
10
-echo "${MY_EMAIL_ADDRESS}" >> /tmp/usb-canary
11
-echo "$(date)" >> /tmp/usb-canary
5
+UPTIME=$(cat /proc/uptime | awk -F '.' '{print $1}')
6
+if [ $UPTIME -gt 120 ]; then
7
+    ADMIN_USER=$(cat /root/${PROJECT_NAME}-completed.txt | grep 'Admin user' | awk -F ':' '{print $2}')
8
+    #MY_EMAIL_ADDRESS=${ADMIN_USER}@$(cat /etc/hostname)
9
+    MY_EMAIL_ADDRESS=root@$(cat /etc/hostname)
10
+    echo "USB device connected on ${DEVPATH}" | mail -s "${PROJECT_NAME} USB canary" ${MY_EMAIL_ADDRESS}
11
+    echo "${ACTION}" > /tmp/usb-canary
12
+    echo "${MY_EMAIL_ADDRESS}" >> /tmp/usb-canary
13
+    echo "$(date)" >> /tmp/usb-canary
14
+fi