Use systemd-shutdownd schedule
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have multiple Redhat & CentOS 7 servers that are used only during working hours. I am looking into using the systemd-shutdownd service to shut down each machine at 6-30pm on workdays.
Systemd appears to be a cleaner solution than cron jobs.
Google shows that there is a schedule file that this service uses, but I have not been able to find how to implement it.
Also, I'd like a way to stop the auto-powerdown in case I work late on a particular day.
centos rhel systemd-timer
add a comment |Â
up vote
0
down vote
favorite
I have multiple Redhat & CentOS 7 servers that are used only during working hours. I am looking into using the systemd-shutdownd service to shut down each machine at 6-30pm on workdays.
Systemd appears to be a cleaner solution than cron jobs.
Google shows that there is a schedule file that this service uses, but I have not been able to find how to implement it.
Also, I'd like a way to stop the auto-powerdown in case I work late on a particular day.
centos rhel systemd-timer
Sorry for my first message. I've just putted exact solution.
â Yurij Goncharuk
Apr 19 at 16:36
fwiw systemd-shutdownd is (was) just the backend to the standardshutdown
.command.shutdown
just lets you schedule one shutdown; it doesn't implement a recurring schedule that will run every day.
â sourcejedi
Apr 19 at 20:47
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have multiple Redhat & CentOS 7 servers that are used only during working hours. I am looking into using the systemd-shutdownd service to shut down each machine at 6-30pm on workdays.
Systemd appears to be a cleaner solution than cron jobs.
Google shows that there is a schedule file that this service uses, but I have not been able to find how to implement it.
Also, I'd like a way to stop the auto-powerdown in case I work late on a particular day.
centos rhel systemd-timer
I have multiple Redhat & CentOS 7 servers that are used only during working hours. I am looking into using the systemd-shutdownd service to shut down each machine at 6-30pm on workdays.
Systemd appears to be a cleaner solution than cron jobs.
Google shows that there is a schedule file that this service uses, but I have not been able to find how to implement it.
Also, I'd like a way to stop the auto-powerdown in case I work late on a particular day.
centos rhel systemd-timer
asked Apr 19 at 13:47
Hussain Akbar
51
51
Sorry for my first message. I've just putted exact solution.
â Yurij Goncharuk
Apr 19 at 16:36
fwiw systemd-shutdownd is (was) just the backend to the standardshutdown
.command.shutdown
just lets you schedule one shutdown; it doesn't implement a recurring schedule that will run every day.
â sourcejedi
Apr 19 at 20:47
add a comment |Â
Sorry for my first message. I've just putted exact solution.
â Yurij Goncharuk
Apr 19 at 16:36
fwiw systemd-shutdownd is (was) just the backend to the standardshutdown
.command.shutdown
just lets you schedule one shutdown; it doesn't implement a recurring schedule that will run every day.
â sourcejedi
Apr 19 at 20:47
Sorry for my first message. I've just putted exact solution.
â Yurij Goncharuk
Apr 19 at 16:36
Sorry for my first message. I've just putted exact solution.
â Yurij Goncharuk
Apr 19 at 16:36
fwiw systemd-shutdownd is (was) just the backend to the standard
shutdown
.command. shutdown
just lets you schedule one shutdown; it doesn't implement a recurring schedule that will run every day.â sourcejedi
Apr 19 at 20:47
fwiw systemd-shutdownd is (was) just the backend to the standard
shutdown
.command. shutdown
just lets you schedule one shutdown; it doesn't implement a recurring schedule that will run every day.â sourcejedi
Apr 19 at 20:47
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
CentOS 7 had systemd
init system.
systemd
has a good feature which is named as timer
. Timer is like service and is intended for starting services at specific time. systemd
shutdown system by calling systemd-poweroff
service. So it's need to write systemd-poweroff.timer
:
$ cat /etc/systemd/system/systemd-poweroff.timer
[Unit]
Description=Poweroff every work day
# Call necessary service
Unit=systemd-poweroff.service
[Timer]
# Power off in working days at 23:00
OnCalendar=Mon,Tue,Wed,Thu,Fri *-*-* 23:00:00
[Install]
WantedBy=timers.target
It's need to do systemctl enable systemd-poweroff.timer
and systemctl start systemd-poweroff.timer
for enable and run timer. After, timer will be started:
$ systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Thu 2018-04-19 19:39:36 MSK 14min left n/a n/a systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Thu 2018-04-19 23:00:00 MSK 3h 34min left n/a n/a systemd-poweroff.timer systemd-poweroff.service
2 timers listed.
Pass --all to see loaded but inactive timers, too.
If you want to disable timer in particular day then it's possible just in case of ordinary systemd service:
# systemctl stop systemd-poweroff.timer
# systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Thu 2018-04-19 19:39:36 MSK 12min left n/a n/a systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
1 timers listed.
Pass --all to see loaded but inactive timers, too.
Perfect. Thanks.
â Hussain Akbar
Apr 20 at 1:22
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
CentOS 7 had systemd
init system.
systemd
has a good feature which is named as timer
. Timer is like service and is intended for starting services at specific time. systemd
shutdown system by calling systemd-poweroff
service. So it's need to write systemd-poweroff.timer
:
$ cat /etc/systemd/system/systemd-poweroff.timer
[Unit]
Description=Poweroff every work day
# Call necessary service
Unit=systemd-poweroff.service
[Timer]
# Power off in working days at 23:00
OnCalendar=Mon,Tue,Wed,Thu,Fri *-*-* 23:00:00
[Install]
WantedBy=timers.target
It's need to do systemctl enable systemd-poweroff.timer
and systemctl start systemd-poweroff.timer
for enable and run timer. After, timer will be started:
$ systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Thu 2018-04-19 19:39:36 MSK 14min left n/a n/a systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Thu 2018-04-19 23:00:00 MSK 3h 34min left n/a n/a systemd-poweroff.timer systemd-poweroff.service
2 timers listed.
Pass --all to see loaded but inactive timers, too.
If you want to disable timer in particular day then it's possible just in case of ordinary systemd service:
# systemctl stop systemd-poweroff.timer
# systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Thu 2018-04-19 19:39:36 MSK 12min left n/a n/a systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
1 timers listed.
Pass --all to see loaded but inactive timers, too.
Perfect. Thanks.
â Hussain Akbar
Apr 20 at 1:22
add a comment |Â
up vote
1
down vote
accepted
CentOS 7 had systemd
init system.
systemd
has a good feature which is named as timer
. Timer is like service and is intended for starting services at specific time. systemd
shutdown system by calling systemd-poweroff
service. So it's need to write systemd-poweroff.timer
:
$ cat /etc/systemd/system/systemd-poweroff.timer
[Unit]
Description=Poweroff every work day
# Call necessary service
Unit=systemd-poweroff.service
[Timer]
# Power off in working days at 23:00
OnCalendar=Mon,Tue,Wed,Thu,Fri *-*-* 23:00:00
[Install]
WantedBy=timers.target
It's need to do systemctl enable systemd-poweroff.timer
and systemctl start systemd-poweroff.timer
for enable and run timer. After, timer will be started:
$ systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Thu 2018-04-19 19:39:36 MSK 14min left n/a n/a systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Thu 2018-04-19 23:00:00 MSK 3h 34min left n/a n/a systemd-poweroff.timer systemd-poweroff.service
2 timers listed.
Pass --all to see loaded but inactive timers, too.
If you want to disable timer in particular day then it's possible just in case of ordinary systemd service:
# systemctl stop systemd-poweroff.timer
# systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Thu 2018-04-19 19:39:36 MSK 12min left n/a n/a systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
1 timers listed.
Pass --all to see loaded but inactive timers, too.
Perfect. Thanks.
â Hussain Akbar
Apr 20 at 1:22
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
CentOS 7 had systemd
init system.
systemd
has a good feature which is named as timer
. Timer is like service and is intended for starting services at specific time. systemd
shutdown system by calling systemd-poweroff
service. So it's need to write systemd-poweroff.timer
:
$ cat /etc/systemd/system/systemd-poweroff.timer
[Unit]
Description=Poweroff every work day
# Call necessary service
Unit=systemd-poweroff.service
[Timer]
# Power off in working days at 23:00
OnCalendar=Mon,Tue,Wed,Thu,Fri *-*-* 23:00:00
[Install]
WantedBy=timers.target
It's need to do systemctl enable systemd-poweroff.timer
and systemctl start systemd-poweroff.timer
for enable and run timer. After, timer will be started:
$ systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Thu 2018-04-19 19:39:36 MSK 14min left n/a n/a systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Thu 2018-04-19 23:00:00 MSK 3h 34min left n/a n/a systemd-poweroff.timer systemd-poweroff.service
2 timers listed.
Pass --all to see loaded but inactive timers, too.
If you want to disable timer in particular day then it's possible just in case of ordinary systemd service:
# systemctl stop systemd-poweroff.timer
# systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Thu 2018-04-19 19:39:36 MSK 12min left n/a n/a systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
1 timers listed.
Pass --all to see loaded but inactive timers, too.
CentOS 7 had systemd
init system.
systemd
has a good feature which is named as timer
. Timer is like service and is intended for starting services at specific time. systemd
shutdown system by calling systemd-poweroff
service. So it's need to write systemd-poweroff.timer
:
$ cat /etc/systemd/system/systemd-poweroff.timer
[Unit]
Description=Poweroff every work day
# Call necessary service
Unit=systemd-poweroff.service
[Timer]
# Power off in working days at 23:00
OnCalendar=Mon,Tue,Wed,Thu,Fri *-*-* 23:00:00
[Install]
WantedBy=timers.target
It's need to do systemctl enable systemd-poweroff.timer
and systemctl start systemd-poweroff.timer
for enable and run timer. After, timer will be started:
$ systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Thu 2018-04-19 19:39:36 MSK 14min left n/a n/a systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
Thu 2018-04-19 23:00:00 MSK 3h 34min left n/a n/a systemd-poweroff.timer systemd-poweroff.service
2 timers listed.
Pass --all to see loaded but inactive timers, too.
If you want to disable timer in particular day then it's possible just in case of ordinary systemd service:
# systemctl stop systemd-poweroff.timer
# systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Thu 2018-04-19 19:39:36 MSK 12min left n/a n/a systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
1 timers listed.
Pass --all to see loaded but inactive timers, too.
edited Apr 24 at 22:18
sourcejedi
18.4k32475
18.4k32475
answered Apr 19 at 14:19
Yurij Goncharuk
2,2582521
2,2582521
Perfect. Thanks.
â Hussain Akbar
Apr 20 at 1:22
add a comment |Â
Perfect. Thanks.
â Hussain Akbar
Apr 20 at 1:22
Perfect. Thanks.
â Hussain Akbar
Apr 20 at 1:22
Perfect. Thanks.
â Hussain Akbar
Apr 20 at 1:22
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f438741%2fuse-systemd-shutdownd-schedule%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sorry for my first message. I've just putted exact solution.
â Yurij Goncharuk
Apr 19 at 16:36
fwiw systemd-shutdownd is (was) just the backend to the standard
shutdown
.command.shutdown
just lets you schedule one shutdown; it doesn't implement a recurring schedule that will run every day.â sourcejedi
Apr 19 at 20:47