D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] Help please Timed shutdown

 

Many thanks Jamie
What a small script for a big job.
I have not tried it yet, as I have one question
Please correct me if I am wrong
As I read it, it would allow the user to log back on but for only five 
minutes during period 2300hours to 0700 hours.
If I set the 5 to 1 will crontab catch it before logon
Thanks again
Trev


> On Thu, Feb 01, 2007 at 10:36:26AM +0000, T Brownen wrote:
>> > I would like a scrip that shuts down the computer between 2300 hours and 
>> > 0700 hours if a named user is or try s to log on.
>> > This is to stop a juvenile staying up to late.
>> > I have tried many ways including Kshutdown (it screwed the login settings)
>> > cron to a script that shut down, partly works but allowed the user to 
>> > log on again.
>> > I have searched the net but to no avail
>> > I have missed a small something, or maybe big could any one help please
>> > Many thanks
>> > Trev
> 
> add this line to crontab, assuming the username is bob
> 
> 5/* 23,0-6 * * * if [ `users|grep -c bob` -gt 0 ]; then /bin/shutdown ; fi
> 
> What it means is every 5 minutes between 23:00 and 6:59 run the line of
> shell script.  The line of shell script looks at the list of logged on
> users.  If the list includes "bob" then shutdown is run.
> 
> 
> 

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html