Scheduling shutdowns
New to the forum. I am running Debian and want to schedule a shutdown every night at midnight. Is this an appropriate method to accomplish this.
I would name the script /etc.con.daily/myshutdown.
I intended to use this line and romove the -r shutdown -r now
I did not see this line in my crontab.
" 02 4 * * * root run-parts /etc/cron.daily"
Here are the instructions I was intending to use. Thanks for your help!
Prerequisite -login as root
Prerequisite -Daemon crond up and running
1. Create the restarting script in /etc/cron.daily, the daily run script directory, using a text editor.
a. Lauch the, say, vi editor to create the restarting script, say, myrestart by typing:
vi /etc/cron.daily/myrestart
b. Type the following content and save:
#!/bin/sh
echo daily scheduler by S K Yuen>/root/schedule.log
date>>/root/schedule.log
shutdown -r now
2.Edit the cron configuratiuon file
a. Edit the cron configuratiuon file /etc/crontab by typing
vi /etc/crontab
b. remark the following line by put a #:
From
02 4 * * * root run-parts /etc/cron.daily
To
#02 4 * * * root run-parts /etc/cron.daily
c. To set cron to run the restarting script file, say, myrestart at 05:25AM, add the following line:
25 05 * * * root bash /etc/cron.daily/myrestart
d. save the file and exit the editor.
|