From 62ebbe33de51681378e0269693ea0a7861fd5e9d Mon Sep 17 00:00:00 2001 From: doc97 Date: Thu, 22 Nov 2018 12:02:59 +0200 Subject: [PATCH 1/2] Rename sfw.sh to away.sh --- sfw.sh => away.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sfw.sh => away.sh (100%) diff --git a/sfw.sh b/away.sh similarity index 100% rename from sfw.sh rename to away.sh From 6af8182fa29bbf9dc76ca0b99fd3783a55c70fe1 Mon Sep 17 00:00:00 2001 From: doc97 Date: Thu, 22 Nov 2018 12:03:26 +0200 Subject: [PATCH 2/2] Add prompt for network and cron user --- networkcheck.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/networkcheck.sh b/networkcheck.sh index 9f22882..3a52c7c 100755 --- a/networkcheck.sh +++ b/networkcheck.sh @@ -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