David, thank you for the compliment and the criticism/suggestion. I have amended the file killstale.txt according to your excellent suggestion, as well as the file containing the companion scripts that I had not previously posted about that is unveiled below.
The script I wrote has been running hourly in our lab since last spring and works well. I just followed my nose in developing the steps and I don't suppose the end result could be any more convoluted. I also realized as I wrote it that it is vulnerable to any changes in the format of some of the outputs that the script relies upon such as ps axu, w -h, and so on. But, for now, it works. I have another, similar but simpler script that depends on one of the outputs of the above killstale.scr that simply kills all the processes owned by any ordinary user who happens to still be logged in at 0110 in the morning - which, of course, also terminates the login. It's a school computer lab, so there should be no real user, so this script just bats clean-up for the original script in case some old logins from the day are still hanging on for dear life. BEWARE, this script will terminate YOU if you run it interactively while still logged in as a user, i.e. "sudo /root/w.scr" or "su -c /root/w.scr" but it will not terminate user "root" if root logged in directly. Needless to say, both of these scripts are wisely set owner:group root:root with permissions 700. You'll find that pair of scripts w.scr and w2.scr in the text file at: http://cathedralsoul.us/files/killusers.txt Andy Figueroa David Groos wrote: > Right. Looking at it again with the feedback from the terminal I got + > the many other clues and well, got things fixed and your scripts works > great! A slight change in your doc that would have helped me: > from: > > Copy the following section (lines 46 - 51) to file "killstale.scr" > > to: > > Copy the following section (lines 46 - 51) to file "killstale2.scr" > > And even adding, 'put killstale2 in /root/' would have helped as well. > > Thanks for this script. > David > > > On Wed, Dec 2, 2009 at 8:41 AM, David Groos <[email protected] > <mailto:[email protected]>> wrote: > > Hi Andy, > I'm really finding a need to kill stale processes and so made a file > on the server, copied lines 3-42 as directed on > http://cathedralsoul.us/files/killstale.txt, made it executable, ran > it. Here's what I got: > dgr...@gcos2:~/Desktop$ sudo '/home/dgroos/Desktop/killstale.scr' > /home/dgroos/Desktop/killstale.scr: 40: /root/killstale2.scr: not found > /home/dgroos/Desktop/killstale.scr: 42: Syntax error: "(" unexpected > dgr...@gcos2:~/Desktop$ > I'd appreciate any advice on using your script. > Thanks! > David > > > On Sat, Aug 29, 2009 at 12:36 PM, Andy Figueroa > <[email protected] <mailto:[email protected]>> wrote: > > Thanks - Asmo. > > One of the threads I was thinking of was included the one I > started on 21 > Apr 2009 at: > > http://www.mail-archive.com/[email protected]/msg05248.html > > The script (two actually) that I currently used has been > improved somewhat > and can be found at: http://cathedralsoul.us/files/killstale.txt > and is reasonably well commented. > > Andy > > Asmo Koskinen wrote: > > Andy Figueroa kirjoitti: > > > >> There was a discussion here a couple of months ago about the > various > >> programs/scripts different system admins run to kill off stale > >> processes. > > > > It's here. > > > > http://marc.info/?l=ltsp-discuss&m=125066771219642&w=2 > <http://marc.info/?l=ltsp-discuss&m=125066771219642&w=2> > > > > https://help.ubuntu.com/community/UbuntuLTSP/GnomeWatchdog > > > > Best Regards Asmo Koskinen. > > > > > > > -- > edubuntu-users mailing list > [email protected] > <mailto:[email protected]> > Modify settings or unsubscribe at: > https://lists.ubuntu.com/mailman/listinfo/edubuntu-users > > > -- edubuntu-users mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/edubuntu-users
