I'm looking for a little help. I was kinda wondering how to turn off network connection for some time period.
My question is - how to set up (for example) "Network connection is available only between 5pm and 6pm?"
Thanks
I'm looking for a little help. I was kinda wondering how to turn off network connection for some time period.
My question is - how to set up (for example) "Network connection is available only between 5pm and 6pm?"
Thanks
You could use crontab to run the scripts at scheduled times. If computer is not running all the time, you may need to combine it with anacron and/or /etc/rc.local
.
The commands to enable/disable network connections are:
nmcli c up id "<connection id>"
nmcli c down id "<connection id>"
You can look for connections and there ids in the /etc/NetworkManager/system-connections/
.
I think your looking for a cron job.
edit /etc/rc.local
and add the following line sudo service network-manager stop
so that networking will be disabled at boot.
next you would want to add a cron job that will start networking at 5pm
crontab -e
00 17 * * 0 sudo service network-manager start
and add another job that will stop networking at 6pm
crontab -e
00 18 * * 0 sudo service network-manager stop
/etc/rc.local
file to disablenetwork-manager
service at boot, then when useat
command to schedule that service being started at 5pm, and finally add another command that kills the service at 6 pm. The network icon won't show up for the user. Limitation, though, is that if the user has access to terminal, they could start the service manually . There's other options too, but I'll need to think about this question a bit. Perhaps others here can provide a faster and easier solution – Sergiy Kolodyazhnyy Oct 29 '15 at 07:24