LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-12-2008, 10:13 PM   #1
newbiesforever
Senior Member
 
Registered: Apr 2006
Distribution: MX (desktop: XFCE 4)
Posts: 2,188

Rep: Reputation: 87
can I time an automatic shutdown?


I usually shut the computer off before going to bed, but I'm downloading the Debian Livecd, and it's downloading slowly enough that I'll have to leave the computer on. Is there any way I can set Linux to shut down the computer automatically in a few hours? I have MEPIS 7.
 
Old 12-12-2008, 10:24 PM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Look into at

for example:

#at now + 2hours
>shutdown -h now
>[ctrl-D]
#
 
Old 12-12-2008, 11:23 PM   #3
newbiesforever
Senior Member
 
Registered: Apr 2006
Distribution: MX (desktop: XFCE 4)
Posts: 2,188

Original Poster
Rep: Reputation: 87
Well, as soon as I learn everything about writing scripts, I'll know how to do this. Thank you.
 
Old 12-13-2008, 12:26 AM   #4
hasanatizaz
Member
 
Registered: Nov 2007
Location: Pakistan
Distribution: Redhat and Debian
Posts: 317
Blog Entries: 1

Rep: Reputation: 35
shutdown -h -t time 120
 
1 members found this post helpful.
Old 12-13-2008, 12:53 PM   #5
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
And what if the CD hasn't finished downloading after two hours? If I were you I'd become root then run

Code:
$ wget http://somewebsite/thecdimage.iso; shutdown -h now
So wget runs and downloads the image, when wget is finished the shutdown command is run.
 
Old 12-13-2008, 06:47 PM   #6
newbiesforever
Senior Member
 
Registered: Apr 2006
Distribution: MX (desktop: XFCE 4)
Posts: 2,188

Original Poster
Rep: Reputation: 87
Duly noted. Thank you.
 
Old 12-15-2008, 08:14 AM   #7
SlowCoder
Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Ubuntu, Mint
Posts: 939

Rep: Reputation: 38
Quote:
Originally Posted by arizonagroovejet View Post
And what if the CD hasn't finished downloading after two hours? If I were you I'd become root then run

Code:
$ wget http://somewebsite/thecdimage.iso; shutdown -h now
So wget runs and downloads the image, when wget is finished the shutdown command is run.
Yep, that's definitely the best/safest method, in my opinion, and one I use often.
 
Old 12-15-2008, 11:41 AM   #8
newbiesforever
Senior Member
 
Registered: Apr 2006
Distribution: MX (desktop: XFCE 4)
Posts: 2,188

Original Poster
Rep: Reputation: 87
OK, I'll do that next time.
 
Old 01-02-2009, 12:00 PM   #9
logic2
LQ Newbie
 
Registered: Feb 2008
Location: Denver, Colorado area, USA
Distribution: Debian 4.0 (Etch)
Posts: 5

Rep: Reputation: 1
It might even be better to use something like:

$ wget http://somewebsite/thecdimage.iso && shutdown -h now

so that if there is a failure the computer stays on so you can read the error message (or pipe the error message to a file then shutdown)
 
Old 01-03-2009, 11:17 PM   #10
newbiesforever
Senior Member
 
Registered: Apr 2006
Distribution: MX (desktop: XFCE 4)
Posts: 2,188

Original Poster
Rep: Reputation: 87
Thanks. Why two &s?
 
Old 01-04-2009, 10:24 AM   #11
Perceptor
Member
 
Registered: Jul 2007
Location: the Future
Distribution: Slackware
Posts: 128

Rep: Reputation: 64
This way the second command is executed _only_ if the first one is successful.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
automatic shutdown muhammednavas Fedora 1 12-01-2006 10:48 AM
Automatic system shutdown chobin SUSE / openSUSE 2 06-05-2006 08:51 AM
Automatic shutdown using ping amelieo Linux - Networking 4 04-24-2004 04:59 AM
automatic shutdown in Mandrake 9.2 lu543285 Mandriva 1 02-13-2004 08:10 AM
Automatic shutdown NetScripter Linux - General 1 10-17-2002 02:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:27 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration