systemd run service during the day

0

I would like to set up my server so that it only connects to the internet during the day.

I created a timer file: [Unit] Description=Start and stop the internet

[Timer]
OnCalendar*-*-* 06:00:00
Unit=netctl@wlan0_sta/x2dInternet.service

[Install]
WantedBy=multi-user.target

But how do I make this shutdown the internet service at the end of the day?

Samuel

Posted 2016-09-15T00:54:20.093

Reputation: 142

Answers

0

You can create a second "service" that also runs on a timer at the end of the day.. Set the "ExecStart=" line of the second service to simply run the shutdown command of the first service:

 ExecStart=/bin/systemctl stop my-service-name.service

Mark Stosberg

Posted 2016-09-15T00:54:20.093

Reputation: 497