LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-09-2005, 02:57 AM   #1
umeshbabu
LQ Newbie
 
Registered: Jun 2005
Location: India
Distribution: RH SUSE FEDORA
Posts: 19

Rep: Reputation: 0
shutdown and starting my box at prespecified time


Hello,

how can i shutdown my box at night 10:00 pm and automatically it should start at morning at 8:00 am.

how can i do this.

i can see command for shutting down box at specified time but how to start at specified time?

thanks for your time
 
Old 09-09-2005, 07:16 AM   #2
morrolan
Member
 
Registered: Sep 2003
Location: Manchester UK
Posts: 262

Rep: Reputation: 30
I don't know how you are going to do this.

Obviously, you can set a shutdown time easily enough - when your computer starts, you should also get it to run a bash script which contains your shutdown command (see man (8) shutdown).

The following has to be run as root unless you give yourself sudo permissions. (man sudo)

Code:
#!/bin/bash

####  Shutdown code

sudo shutdown 22:00 The system is going to shutdown automagically at 10pm!

cp /etc/nologin nologin_backup
rm /etc/nologin
This would probably need to be run in the background to avoid wasting a terminal.

Also, I do not vouch for how safe deleting the /etc/nologin file is - this is created if the shutdown command is issued with any kind of delay, whether a countdown or a preset time, and it's purpose is to not allow anyone to log in once a shutdown command has been issued. You might be ok if this script is run from your .bashrc or .bashprofile, as these are executed once you login, so as long as you don't log out before 10pm you're fine.

As for booting at a specific time - I have no idea unless you can do it through some kind of suspend/resume function, rather than a complete shutdown.

I suppose you can always set an alarm clock for 8:00am and then train your cat to press the power button!

Last edited by morrolan; 09-09-2005 at 07:19 AM.
 
Old 09-09-2005, 10:50 AM   #3
logosys
Member
 
Registered: Jul 2005
Location: Texas
Distribution: RHEL4 - ES
Posts: 178

Rep: Reputation: 31
Unfortunately, there isn't a way to have the operating system turn the computer on (can you imagine the chaos that would ensue?) so you have two options:

A) Concoct a Rube Goldberg Machine that is actuated by an alarm clock. When the clock hit's 8, it drops a ball that flips a lever that launches a ball into the air (insert other operations here) that pushes a rod that turns the computer on. (Rube Goldberg Tips) I don't recommend this.

B) Alternatively, you can have another computer on your network send a WOL (Wake on LAN) signal to your computer. I've used ether-wake for this purpose, it works very well. It has really good Documentation. You can download the source for it from Scyld's website: .c file

Hope this helps.
 
  


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
Remote Shutdown of Windows using a linux box? bigdog0007 Linux - Networking 7 05-12-2005 11:07 AM
Logout/shutdown box won't appear in Gnome under RH9 IBBoard Red Hat 2 07-12-2004 10:50 PM
no signal when starting xorg for the 1st time (but the second time works fine) bungalowbill Linux - Software 0 06-04-2004 10:56 AM
how to shutdown iptables from starting ever again?!@ package Linux - General 3 05-26-2003 10:05 AM
KDE: anybody can shutdown my box!!! How to prevent this? vous Linux - Software 5 05-25-2003 05:07 AM


All times are GMT -5. The time now is 01:06 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration