LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-18-2003, 12:02 AM   #1
k_ranju
LQ Newbie
 
Registered: Jul 2003
Location: India
Distribution: redhat
Posts: 2

Rep: Reputation: 0
Question Auto Shutdown


I am having 30 machines and one NIS server running on Redhat Linux 9.
I want to shutdown the machines automatically which are idle for 30 minutes. (even if the user is logged in..and he is idle.. it shld work)
 
Old 07-18-2003, 03:35 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
this forum is clearly called "member intro" and only for saying "hello".

moved to correct forum.
 
Old 07-18-2003, 10:11 AM   #3
enigmasoldier
Member
 
Registered: Jul 2003
Location: Florence, Ky
Distribution: CentOS 3.3-4, OpenBSD 3.3, Fedora Core 4, Ubuntu, Novell Open Enterprise Server
Posts: 213

Rep: Reputation: 30
Unfortunately, I am currently at an area where I cannot access a linux machine (not even Knoppix!). I can still point you in the right direction and give you some ideas of what to do.

I love to write bash and sh scripts. This is how we are going to solve your problem.

Write a script that does the following:
runs the command w (w will display idle time in one of the columns)
uses sed or awk to parse the output of the idle collumn and place it into a variable

uses simple logic

if [ $idle >= 30]; then
`logout`

You could save this script on each computer and have it run using crontab every minute "if your paranoid" or every 5 minutes.

I personally like solutions that are scalable. I use the Configuration Engine Using cfengine, you could auto push the scripts out to each host, update it on one machine, and then auto push it out to every other machine. Cfengine is very well documented. You shouldn't have alot of trouble with it.

This solution might take a week or two to play with and implement, but you will learn to appreciate cfengine once you get it running.

Links
http://www.cfengine.com
http://www.gnu.org/manual/cfengine-1...rence_toc.html
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html I can never stress these enough!
http://www.tldp.org/LDP/abs/html/
http://www-106.ibm.com/developerwork...ry/l-sed1.html
http://www-106.ibm.com/developerwork...ry/l-sed2.html
http://www-106.ibm.com/developerwork...ry/l-sed3.html
http://www-106.ibm.com/developerwork...ry/l-awk1.html
http://www-106.ibm.com/developerwork...ry/l-awk2.html
http://www-106.ibm.com/developerwork...ry/l-awk3.html
 
Old 07-20-2003, 04:43 AM   #4
slapNUT
Member
 
Registered: Jun 2001
Location: Recycle Bin
Distribution: Linux & Everything else on VirtualBox
Posts: 144

Rep: Reputation: 15
Look as this. You could combine that with the script that enigmasoldier mentioned.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Shutdown at stated hours br_sriram Linux - Hardware 8 10-23-2004 10:54 AM
ssh auto shutdown mazzo Linux - Security 4 08-13-2004 05:55 PM
Auto Shutdown - Red Hat 9 jt1020 Linux - General 5 06-01-2003 09:38 PM
how to auto powerdown at shutdown fysx Linux - Software 1 05-09-2003 03:09 PM
Auto Shutdown at time Crazy Banana Linux - General 3 11-26-2002 07:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:01 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
Open Source Consulting | Domain Registration