Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
9 changes: 6 additions & 3 deletions networkcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

# This script checks if you are connected to your home network
# and changes crontab accordingly
CHECK=`nmcli | grep (Your home network SSID here)$`
read -s "Home network (SSID): " SSID
read -s "Cron user: " CRON_USER

CHECK=`nmcli | grep ${SSID}$`
if [ -z "$CHECK" ] ; then
sed -i -e 's/home.sh/away.sh/g' /var/spool/cron/(USER)
sed -i -e 's/home.sh/away.sh/g' /var/spool/cron/${CRON_USER}
else
sed -i -e 's/away.sh/home.sh/g' /var/spool/cron/(USER)
sed -i -e 's/away.sh/home.sh/g' /var/spool/cron/${CRON_USER}
fi