LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 06-01-2005, 02:47 PM   #1
avenolpey
LQ Newbie
 
Registered: Jun 2005
Posts: 9

Rep: Reputation: 0
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.
 
Old 06-01-2005, 11:05 PM   #2
donni
Member
 
Registered: Aug 2003
Location: Crawley
Distribution: Debian GNU/Linux Sid
Posts: 49

Rep: Reputation: 15
A more appropriate way would be:

First of all, put the script in cron.d instead, and call it restart. That way there is no need to comment out the daily part.
Then run chmod 755 /etc/cron.d/restart, to make it a proper executable script.
Then I believe you can just add
00 00 * * * root /etc/cron.d/restart
to crontab, so it will run at midnight. I may be wrong about the time format, but hey, yours was set to 05:25 in the morning.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux shutdowns sernan Linux - Newbie 4 09-05-2005 10:32 AM
system shutdowns KDElinux Linux - Software 2 12-30-2004 05:38 PM
user that shutdowns the computer matevzp Linux - General 1 12-07-2004 05:39 AM
Soft shutdowns Maverick1182 Linux - Newbie 4 08-17-2004 08:13 AM
Bad Shutdowns SierraClassic35 Linux - General 7 09-18-2001 12:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 04:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration