Autoshutdown in Linux.. ??

Status
Not open for further replies.

dabster

In the zone
In windows we have a option which auto shutdowns or Hibernate yr computer if it is idle for a certain time which you can deceide....
Ubuntu allows to Hibernate but is there any option which allows me to set tht if my comp is idle for more than 1/2 an hour it should automatically hibernate...
 

JGuru

Wise Old Owl
Yes, there is an option available in all Linux distros. Type 'xscreensaver-demo' in the
Terminal or you can open 'screensaver' in the '/usr/share/applications' folder.
Click on the 'Advanced' tab.There on the top-right there is a header called 'Display Power Management' Click on the checkbox 'Power Management Enabled'. There are Options like 'Standby After : 30 min', 'Suspend After: 45 min', 'Off After : 60 min'. For auto-shutdown , by default the System shuts down automatically
after being idle for 60 min (1 hour). You can customize it as per your needs.
That's all.
 

mediator

Technomancer
Well I dont use the screensaver method! I have developed a script that performs autoshutdown......I developed coz i have to shutdown limewire and all downloads and the system at 8:00 am......coz i have mtnl 590 broadband!! Neways u may use my script

*************** save as "autoshutdown.sh"****************
echo -n "Enter shutdown timing (like 06-00) : ";read tim
echo "Shutdown scheduled for $tim"
while [ 1 ]
do
if [ "`date "+%H-%M"`" = "$tim" ];then
echo "`date -R`" > log.log
/sbin/shutdown -h now
echo "SHutdown Initiated"
exit
else
echo -n ""
fi
done
*************** Run as root as "sh autoshutdown.sh" ***********

Have fun......Enter the timing as 15:00 for 3pm and 07:00 for 7 am etc !!
U may see log.log file where u saved autoshutdown.sh for shutdown history!
 
Last edited:

GNUrag

FooBar Guy
mediator, that was cool!
there is another way many people use, they rather send commands to the adsl router and shutdown that instead. i'll locate the script and post it.
 

ApoorvKhatreja

Journeyman
I'm using Ubuntu 6.10 (Edgy Eft) and I have an MTNL 590 NU plan which requires a reboot at 12:00 A.M. and 8:00 A.M. In Windows, I have automated this process by shifting my modem to bridged mode, and then i can connect/disconnect by merely scheduling the dialling of a connection. But in Ubuntu, I am not even able to get my connection running. Could somebody help me?

I configured my modem by this link -
*broadbandforum.in/Utstarcom-Bridge-Mode-Configuration-And-Automatic-Router-Reboot-t4794.html
 

Desi-Tek.com

In the zone
@mediator i think using of poweroff command would be better than shutdown -h.
as it will close the program forcefully
Code:
echo  "time now is - `date "+%H:%M:%I"`" 
echo -n "Enter shutdown timing (like 06-00) : ";
read tim

echo "Shutdown scheduled for $tim"
while [ 1 ]
do
if [ "`date "+%H-%M"`" = "$tim" ];then

echo "`date -R`" > log.log
poweroff
echo "SHutdown Initiated..."
exit
else
echo -n ""
fi
done
can u pls add the code to display current time in while loop and time remaining to shutdown pc?
 
Last edited:

mediator

Technomancer
^^shutdown -h also kills all the programs forcefully!
The code u asked for is easy to add, but I dont know how to play with cursors. If I add the code, it will be repeatedly shown on the screen and may make the terminal cache unstable resulting in the failure of the program.
 
Status
Not open for further replies.
Top Bottom