Results 1 to 8 of 8
Hello !
I'm wondering if there is any program that could turn off my computer after a chosen time. For example, I choose a time on the software and my ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 06-19-2009 #1Just Joined!
- Join Date
- Jun 2009
- Posts
- 6
[SOLVED] Is there any program that could automatically turn off a computer ?
Hello !
I'm wondering if there is any program that could turn off my computer after a chosen time. For example, I choose a time on the software and my computer will be switched off when I'm not here.
Is it possible ?
Thank you !
- 06-19-2009 #2Linux Guru
- Join Date
- Nov 2004
- Posts
- 6,110
You can shutdown your computer from the command line using shutdown. Using this in combination with cron you can set your PC to shutdown anytime you like.
- 06-19-2009 #3forum.guy
- Join Date
- May 2004
- Location
- arch linux
- Posts
- 18,733
Doing as Big Tom suggested, you can set it to shutdown in a certain number of minutes, or at a certain time of the day.
You could also make a button for it using some such command if you wish to run the command from the GUI.oz
- 06-20-2009 #4Just Joined!
- Join Date
- Jun 2009
- Posts
- 6
Thank you for your answers !
I think I'm going to use the first way (using the command line "shutdown")
- 06-20-2009 #5
I wrote a script.
It verifies the date from minute to minute. It's not the smartest design, someone smarter than myself would've calculated the difference between the current and target time then just have waited for it to run out. But anyway, this ought to work.Code:#!/bin/bash if [ "`whoami`" != "root" ]; then echo "You must be root to run this."; exit 1; fi if [ $# -ne 1 ]; then echo "You didn't specify the time. e.g. 12:00"; exit 2; fi while true do CurrentDate=`date` CheckThis=`echo $CurrentDate | grep $1` if [ -n "$CheckThis" ]; then echo "Shutting down now: `date`."; shutdown -h now; else echo "Waiting some more: `date`"; sleep 1m; fi done
- 06-20-2009 #6Just Joined!
- Join Date
- Jun 2009
- Posts
- 6
Oh, thanks a lot for this.
- 06-20-2009 #7Linux User
- Join Date
- Jan 2006
- Posts
- 414
why all the scripting and cron and such?
will shutdown the system in 30 minutes, orCode:$ shutdown -h +30
will shutdown the system at 4:28PM, for more details:Code:$shutdown -h 16:28
Code:$ man shutdown
- 06-20-2009 #8


Reply With Quote

