D&C GLug - Home Page

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

Re: [LUG] Help please Timed shutdown

 

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