|
#!/usr/bin/perl -w # # gniter --crb3 29oct04/30mar07 # # when invoked, keeps a user off the machine, by killing every # process they own. cron invokes it, and cron dismisses it by # deleting its lockfile. do your children sneak back onto their # machines after lights-out? # yes, some systems support login-time controls. this drops into # all linux systems, using crontab. # $user="child"; $user=$ARGV[0] if defined $ARGV[0]; $mylock="/home/$user/.gnited"; `touch $mylock`; while(-e $mylock){ (@rsp)=(split("\n",`ps --user $user`)); foreach $ln ( reverse (@rsp)){ # base-level last chomp $ln; next if $ln =~ /^\s+PID/; $pid=(split(/\s+/,$ln))[0]; # 396 tty1 00:00:00 startx push(@used,$pid); } kill("HUP",(@used)); sleep(30); } |
Grab a gzipped copy here |
| Syntax highlighting using Syntax::Highlight::Engine::Kate |