• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved How to Automatically Shut Down Servers at Defined Times?

iGraphics

Basic Pleskian
Hello Everyone,

How to Automatically Shut Down Servers at Defined Times?
I want to Shut Down my server on 25/Dec/2017 at 03:00 PM

Can I make that by Scheduled Tasks in Plesk control panel ?
or By SSH ?

Please if by SSH give me the command line for shutting down on 25/Dec/2017 at 03:00 PM

OS ‪CentOS Linux 7.4.1708 (Core)‬
Product Plesk Onyx
Version 17.5.3 Update #35, last updated on Dec 20, 2017 03:31 AM



Thanks
 
Hello Everyone,

How to Automatically Shut Down Servers at Defined Times?
I want to Shut Down my server on 25/Dec/2017 at 03:00 PM

Can I make that by Scheduled Tasks in Plesk control panel ?
or By SSH ?

Please if by SSH give me the command line for shutting down on 25/Dec/2017 at 03:00 PM

OS ‪CentOS Linux 7.4.1708 (Core)‬
Product Plesk Onyx
Version 17.5.3 Update #35, last updated on Dec 20, 2017 03:31 AM



Thanks

Hello,
the easiest will be to add a cronjob with the command crontab -e , and to add the following line :
Code:
0 3 25 * * /sbin/shutdown now
 
Hi,

One of the ways:

Use command `at` and `atd` daemon:
1. Install at
# yum install -y at

2. Start atd
# service atd start

3. Plan to do something:
# echo "touch /tmp/1.txt" | at 1629 Dec 20
job 1 at Wed Dec 20 16:29:00 2017


4. Check:
# date
Wed Dec 20 16:29:09 NOVT 2017
# ls -la /tmp/1.txt
-rw-r--r-- 1 root root 0 Dec 20 16:29 /tmp/1.txt


So, if it works for you, you can use any other date and any other command. If you execute this command as user, use `sudo`.
 
Thanks for reply, What about this command line:
Code:
screen -d -m shutdown -h +$((($(date +%s -d "12/25 15:00 2017") - $(date +%s)) / 60))
 
Back
Top