My own confoxtal the easy way (at least for me);
#!/bin/sh
# /jffs/scripts/services-start
cru a blockdev "30 22 * * sun,mon,tue,wed,thu sh /jffs/scripts/blockdev.sh"
cru a relall "0 7 * * * sh /jffs/scripts/relall.sh"
cru a relallwk "28 0 * * sun,sat sh /jffs/scripts/relall.sh"
cru a blockdevwk "30 0 * * sun,sat sh /jffs/scripts/blockdev.sh"
Control script:
#!/bin/bash
# /jffs/scripts/blockdev.sh
echo "#!/bin/bash">/jffs/scripts/relall.sh
echo "">>/jffs/scripts/relall.sh
chmod a+rx /jffs/scripts/relall.sh
# copy below block for other devices, copy MAC address from dhcp list from GUI asus
# Samsung(android)_My_Son
mmac=AA:BB:7B:C6:55:44
vmac=$(echo "$mmac" | awk '{print tolower($0)}')
kmmac=$(cat /var/lib/misc/dnsmasq.leases | grep "$vmac" | cut -d" " -f3)
if ! [ -z "${kmmac}" ]; then iptables -I FORWARD -s $kmmac -j DROP; fi
if ! [ -z "${kmmac}" ]; then conntrack -D --src=$kmmac; fi
if ! [ -z "${kmmac}" ]; then echo iptables -D FORWARD -s $kmmac -j DROP>>/jffs/scripts/relall.sh; fi
On school days cut off internet at 22:30, on weekends at 00:30, release all days at 07:00
# Example of Cron job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
Have fun and be amazed your son/daughter wants to go to bed at 22:31
#!/bin/sh
# /jffs/scripts/services-start
cru a blockdev "30 22 * * sun,mon,tue,wed,thu sh /jffs/scripts/blockdev.sh"
cru a relall "0 7 * * * sh /jffs/scripts/relall.sh"
cru a relallwk "28 0 * * sun,sat sh /jffs/scripts/relall.sh"
cru a blockdevwk "30 0 * * sun,sat sh /jffs/scripts/blockdev.sh"
Control script:
#!/bin/bash
# /jffs/scripts/blockdev.sh
echo "#!/bin/bash">/jffs/scripts/relall.sh
echo "">>/jffs/scripts/relall.sh
chmod a+rx /jffs/scripts/relall.sh
# copy below block for other devices, copy MAC address from dhcp list from GUI asus
# Samsung(android)_My_Son
mmac=AA:BB:7B:C6:55:44
vmac=$(echo "$mmac" | awk '{print tolower($0)}')
kmmac=$(cat /var/lib/misc/dnsmasq.leases | grep "$vmac" | cut -d" " -f3)
if ! [ -z "${kmmac}" ]; then iptables -I FORWARD -s $kmmac -j DROP; fi
if ! [ -z "${kmmac}" ]; then conntrack -D --src=$kmmac; fi
if ! [ -z "${kmmac}" ]; then echo iptables -D FORWARD -s $kmmac -j DROP>>/jffs/scripts/relall.sh; fi
On school days cut off internet at 22:30, on weekends at 00:30, release all days at 07:00
# Example of Cron job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
Have fun and be amazed your son/daughter wants to go to bed at 22:31