[QCLUG] Kid timer
Jim Hall
volunteer.jim@gmail.com
Thu, 13 Jul 2006 15:11:09 -0500
---------------------- multipart/alternative attachment
Now that my gmail account works on the list, I have a project for our
programmers. I mentioned this at the meeting and it was deemed worthy of
discussion. Since we have had little traffic lately, I thought I'd post the
entire thread from a low level help forum (no programmers). Some useful
hints did come up, but I need help. Can anyone get me started?
BTW, research and conversations indicate that I should use anacron because
the computer won't be on all the time.
Jim
*************************************
Friends need a system wide timer to put brakes on kid usage. At 10:55 p.m. a
broadcast notice should pop up for any active user. At 11:00 p.m. the system
does a "shutdown -h now" no matter what. No logins will be allowed until
10:00 a.m. the next morning (excepting root and the admin user). Of course,
school times will be different, so the script (or whatever) needs to be
editable.
I'm not too good at creating this kind of thing; Mom has steam coming out of
her ears, so I'm under the gun to prove that Linux can do something really
useful for her.
Any suggestions gratefully received.
slopoke
********************
Try "kshutdown" ...........maybe there's a way to hide it from the little
ones.
It works great!
*******************
This may or may not be something you're interested in...
If you want to write your own script...look around enough to find the right
bash command that does (individually) each of the items you metioned... then
arrange those commands in the correct sequential order in one or more shell
scripts... then set a crontab to execute the scrip(s) at the desired time.
*********************
here is a short howto.. maybe it would work for you..
http://www.cyberciti.biz/nixcraft/vivek/blogger/2005/10/howto-shutdown-linux-box-automatically.php
******************
The above link will work to shutdown the machine and I'm now thinking of
using it, as like you the kids are sometimes still on the machinme late at
night.
So far as not allowing login to the machine until 10 the next day, you could
use a new login that only you have the password for, or change the passwords
for the existing user account? Really depends on how access to the machine
is given now. Is it by a genric account or does each person have thier own
account?
Neil.
****************
I has a similar problem with my kids, they where in the chat rooms and
surfing till all hours of the night even sneaking down after we went to bed.
If you have a adsl router it may be worth looking at the router web pages as
many routers have built in software to control usage mine does. It shuts
down at 23:00 every night and does not allow any access to the outside world
until 06:00 in the morning, but it has a password overide so that if I am on
I can continue without interuption for another hour before it asks me for
another password,just incase I go to bed and the kids sneak down.....
I did try the software route on my pc but i have a couple of smart kids and
they managed to get round it.......by logging into another distro on the
pc...the router just kills all access and cannot be hacked.
Steve
******************
Fleshing out the thread so far.
ljogerst: I'll install "kshutdown" and see what it offers. "Hiding it from
the little ones" is mandatory, they are 12 to 17.
slashpine: Sorry, when I said I wasn't very good at this I meant creating
scripts. My limit is about 5 lines and very simple. I suppose I expected
scripts. If there were a package for this, it would have surfaced by now.
Unless "kshutdown" works.
raldz: I just read it. I think it will work. That should take care of the
"turn off" phase.
neilloffhagen: Because the machine is not on 24/7 "cron" won't work. If it's
not on at 11:00, all the kids have to do is wait until 11:01 to turn it on.
The easiest substitute is "anacron", it's not dependent on the system
running. (I've been reading)
Answer to your question. There are separate accouts for every user, adults
and children. Mon wants everyone off, that's why the system wide, not
specific users, shutdown.
stumpey: Sounds good except that the router is a low end unit with almost no
config options (also, can't kill the entire network). Ive strongly suggested
that they get a better one, but until it dies, that won't happen. As far as
another bootable CD, in BIOS, disable all removable media as bootable
(usually still work when the OS boots). Put as strong a password as you can
for access to BIOS. If BIOS has a normal and supervisor, use both
(different, of course). Don't try to remember them, write them down and lock
them up! So, as you can see, I have that problem solved (until they become
interested enough to learn how to crack them).
BTW, routers can indeed be hacked. It's easier from the inside, but possible
from the outside. Not usually by mere mortals, though.
So far, the shutdown part of this looks doable. Because there seems to be no
effective way to prevent turning the machine back on, The only option looks
like controlling login. If whatever controls the login process can be made
to not accept a users login until 10:00 a.m., then I think most of the
pieces will be in place.
slopoke
********************
since it is the internet connections that is the draw...
a non tech solution may be to move the modem/router to a location not
accessable to the "kids" and use an electrical "timer"...(used to turn
lights etc. on and off )
************************
Do use a cron job, dont shut the computer off. If they shut it off have it
halt until admin password is set before going into x
**********************
I don't know if this will work, but somehow a good idea.. if your LAN cards
has a wake-on-lan capability, then why not disable all the POWER button of
your hardware.. then write a short script to PING all the machines on a
central computer.. at this way, when you run the PING script, it will turn
on all your computers in the LAN.. but this will only work on cards with
wake-on-lan..
**************************
Since I'm familiar with the house, I can safely say that there is no such
place. Good idea, been tried, won't work.
slopoke
************************
This setup has to be self contained because I'm only there one or two days a
week.
slopoke
**********************
Yes, it is a good idea. However, the network is just shared access, no
central computer. Also, since someday this will be converted to control
specific users, I'll still have to do this. Then or now, better now.
slopoke
***********************
OK, I'm no script expert, so you would have to get the exact script syntax
to make it work, but I would suggest the following:
1. create a script that does '/usr/bin/xmessage System goes down in 5
minutes. Please logout'. This is the popup on the screen
2. make a crontab to call that script at the desired hour on the desired
days of the week.
3. make a script that does '/usr/sbin/usermod -L <login>. For each login a
line like this. This command will lockout a user account
4. Let this script run 1 minute after the popup with another crontab
5. Make a crontab to 'shutdown now' at the required time
6. Now comes the tricky part. You should have a script that is run at
startup. It should check the time of the day and the day of the week, and
either leave all accounts locked, or unlock the accounts:
if (time > 10.00 and time < 22.00) {
usermod -U <login>
}
you know what I mean....
I guess that is what you want. It is not so hard I think, just need to dig
into some bash scripting. When I have the time and the inclination I'll look
at the specifics...
Cheers and good luck
***********************
This is basically what I was referring to in my original reply...FWIW...you
would only need one "crontab"... it would list all the "cron jobs" that
would execute the scripts.
This could also be done remotely without the use of cron by running the cron
on a remote system and having it call up and execute the scripts from
afar...
************************
This reminds me I'm looking for someway to control how long kids stay logged
onto the computer. For instance, I have installed Linux on my mom's computer
and each of my nieces and nephews is allowed to only play on their half an
hour at a time. Is there are way to force them to log out and then lock each
one out for a certain amount of time (like an hour) before allowing them to
log back in again?
**********************
You could use cron to:
Warn the user of impending shut down: I would do this at a certain time, the
have the script wait so many minutes then log them out.
Within that cron use password -l username to "lock" the password (for each
kid) now they wont be able to log back in until the password is unlocked,
which is password -u username.
You can edit KDM to not allow users to shut down the computer, and you can
edit the startup scripts so that if they do shut down the computer (via a
switch or pulling the plug) the passwords set to lock until the cron to
unlock comes around again.
The only way to have control over the computer is to leave it on all the
time.
I hope that gets you started.
I have never used kcron but that might be something to look into as well.
***********************
---------------------- multipart/alternative attachment
An HTML attachment was scrubbed...
URL: http://qclug.org/pipermail/qclug/attachments/a2b5d411/attachment.htm
---------------------- multipart/alternative attachment--