How to kill all screens that has been up longer then 3 weeks?
Posted
by Darkmage
on Server Fault
See other posts from Server Fault
or by Darkmage
Published on 2010-05-19T09:59:54Z
Indexed on
2010/05/19
10:10 UTC
Read the original article
Hit count: 265
Im creating a script that i am executing every night at 03.00 that will kill all screens that has been running longer than 3 weeks.
anyone done anything similar that can help? If you got a script or suggestion to a better method please help by posting :)
I was thinking maybe somthing like this.
First do a dump to textfile
ps -U username -ef | grep SCREEN >> dump.txt
then do a loop running through all lines of dump.txt with a regex and putting pid of the prosseses with STIME > 3weeksago in a array.
then do a kill loop on the array result.
© Server Fault or respective owner