LinuxQuestions.org
Register a domain and help support LQ
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 07-18-2003, 01:39 AM   #1
yktang
LQ Newbie
 
Registered: Jul 2003
Posts: 15

Rep: Reputation: 0
Auto Shut Down


Hi everyone,

Is there any way to shut down my desktop automatically? What I want is after certain time period, say 2 hrs, with no mouse movement and keystroke detected (similar to activate screensaver), the desktop shutdown by itself. Is there any built-in functions, scripts, or commands that I can use?

Thanks in advance

Last edited by yktang; 07-18-2003 at 01:59 AM.
 
Old 07-19-2003, 08:18 AM   #2
mrGee
Member
 
Registered: Dec 2001
Location: Netherlands
Distribution: redhat suse mandrake freebsd
Posts: 344

Rep: Reputation: 30
Hi

By 'shutting down the desktop' you mean logout without
powering down your box i guess ?
If i recall, you can use xlock to do this;
man xlock
It has logout or autologout functions, just play around
with some of the options.

good luck
 
Old 07-19-2003, 09:25 AM   #3
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 64
Hi!!!

I don't know if this is of any help, but you could use the shutdown command with a delay time as well. E.g:

shutdown -t <time in seconds to shutdown>

or

shutdown -time <when to shutdown your computer>

To see how to use all the functions of the shutdown command, type

man shutdown

It will bring a cool list with options and details about each possible command

Good Luck
 
Old 07-19-2003, 11:10 AM   #4
yktang
LQ Newbie
 
Registered: Jul 2003
Posts: 15

Original Poster
Rep: Reputation: 0
Thank you for your reply. But I need more help on this.

What I am really looking for is a command which will start another command/script (in my case, shutdown -h now) after certain period with NO mouse and keyboard inputs detected.

I used crontab to schedule the job. But it shutted down at a specific time (say 2:30am). But I want something similiar to Labtop Power Management (but mine is a desktop), instead of Standby and Suspend, I want shutdown.

Thanks
 
Old 07-19-2003, 02:21 PM   #5
yktang
LQ Newbie
 
Registered: Jul 2003
Posts: 15

Original Poster
Rep: Reputation: 0
I found out from another post that command 'w' can help me to find the idle time. I am now working on the script to make it work. Thanks
 
Old 07-19-2003, 04:27 PM   #6
mrGee
Member
 
Registered: Dec 2001
Location: Netherlands
Distribution: redhat suse mandrake freebsd
Posts: 344

Rep: Reputation: 30
Hi

Still you can make use of the xlock like this;

xlock -mode ant +usefirst -startCmd "sleep 100; shutdown -h now" &

make sure that the user actually can shutdown, or place that in the
/etc/sudoers
and place the xlock command in some init file or autostart folder

-mode ant ; one of the screensaver modes
-startCmd ; will be executed when xlock fires up and will be
killed if the user unlocks the desktop
commands should be within the " " part
+usefirst ; first key will not be the first password key
default; it is.
sleep 100 ; waits 100 seconds then shutdown

there are several options to catch mouse movements also

If you use KDE, do man xscreensaver and read the part for KDE
read the part for other windowmanagers in the xscreensaver
manual also

some other nice things -inroot or -inwindow just for foolin'
around


Regards
 
  


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
display auto-shut off amadkow Fedora 8 01-28-2005 05:28 PM
Auto shut down server ! the_reen Red Hat 1 07-08-2004 11:01 PM
auto-completion - how does it work & can my script args auto-complete? BrianK Programming 1 06-11-2004 05:51 PM
shut down won't shut system down taoweijia Linux - General 3 03-03-2004 07:05 PM
the network card auto shut-off after few minutes from power up pmeccanico Linux - Hardware 2 06-25-2002 02:42 AM


All times are GMT -5. The time now is 02:07 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