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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
07-18-2003, 01:39 AM
|
#1
|
LQ Newbie
Registered: Jul 2003
Posts: 15
Rep:
|
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.
|
|
|
07-19-2003, 08:18 AM
|
#2
|
Member
Registered: Dec 2001
Location: Netherlands
Distribution: redhat suse mandrake freebsd
Posts: 344
Rep:
|
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
|
|
|
07-19-2003, 09:25 AM
|
#3
|
LQ Guru
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,337
Rep:
|
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
|
|
|
07-19-2003, 11:10 AM
|
#4
|
LQ Newbie
Registered: Jul 2003
Posts: 15
Original Poster
Rep:
|
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
|
|
|
07-19-2003, 02:21 PM
|
#5
|
LQ Newbie
Registered: Jul 2003
Posts: 15
Original Poster
Rep:
|
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
|
|
|
07-19-2003, 04:27 PM
|
#6
|
Member
Registered: Dec 2001
Location: Netherlands
Distribution: redhat suse mandrake freebsd
Posts: 344
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 02:08 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|