Skip to content

Commit

Permalink
Check md5sum from file and log changes
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarcos87 committed Jun 6, 2019
1 parent 9ec22af commit 8144086
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/ubus-lime-metrics/files/usr/sbin/last_internet
Expand Up @@ -34,12 +34,13 @@ fi
printf $result

if [ ! -z "$result" ] && [ "$1" = "save" ] ; then
newSum=$(echo $result | md5sum | cut -d' ' -f 1)
echo -n -e "$result" > /tmp/last_internet_path
newSum=$(md5sum /tmp/last_internet_path | cut -d' ' -f 1)
oldSum=$(md5sum /etc/last_internet_path | cut -d' ' -f 1)
if [ "$newSum" != "$oldSum" ]; then
echo -n -e "$result" > /etc/last_internet_path
echo 'Last path to internet updated'
logger 'Last path to internet updated'
else
echo 'Last path to internet has no changed'
logger 'Last path to internet has no changed'
fi
fi

0 comments on commit 8144086

Please sign in to comment.