Autoshutdown in Linux.. ??

Discussion in 'Open Source' started by dabster, Jun 27, 2006.

Thread Status:
Not open for further replies.
  1. dabster

    dabster New Member

    Joined:
    Jul 21, 2005
    Messages:
    487
    Likes Received:
    0
    Trophy Points:
    0
    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...
     
  2. JGuru

    JGuru Well-Known Member

    Joined:
    Dec 25, 2005
    Messages:
    1,705
    Likes Received:
    32
    Trophy Points:
    48
    Location:
    Space-time continuum
    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.
     
  3. mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    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: Jun 28, 2006
  4. GNUrag

    GNUrag FooBar Guy

    Joined:
    Jun 22, 2004
    Messages:
    1,246
    Likes Received:
    5
    Trophy Points:
    0
    Location:
    Interwebs
    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.
     
  5. ApoorvKhatreja

    ApoorvKhatreja New Member

    Joined:
    Aug 15, 2006
    Messages:
    229
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    Delhi
    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 -
    http://broadbandforum.in/Utstarcom-Bridge-Mode-Configuration-And-Automatic-Router-Reboot-t4794.html
     
  6. Desi-Tek.com

    Desi-Tek.com New Member

    Joined:
    Oct 15, 2006
    Messages:
    370
    Likes Received:
    4
    Trophy Points:
    0
    Location:
    Mumbai
    @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: Nov 18, 2006
  7. mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    ^^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.
     
Thread Status:
Not open for further replies.

Share This Page