From 0d76193453028f7736c55fa8b53dd3083a1fcae0 Mon Sep 17 00:00:00 2001 From: Eric Swenson Date: Sat, 10 Dec 2016 19:03:34 -0800 Subject: [PATCH] Added TMPKIL and hourly DRAGON job to clean out .TEMP.; --- README.md | 1 + build/build.tcl | 5 +++ src/syseng/tmpkil.12 | 100 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+) create mode 100644 src/syseng/tmpkil.12 diff --git a/README.md b/README.md index a7452f0f..de36b40d 100644 --- a/README.md +++ b/README.md @@ -188,6 +188,7 @@ There's a [DDT cheat sheet](doc/DDT.md) for Unix users. - TELNET, Telnet client. - TELSER, Telnet/Supdup server. - TIMOON, displays the time and phase of the moon. + - TMPKIL, clean out old files in .TEMP.;. - TTLOC, Advertises physical location of logged in users. 6. A brand new host table is built from the host table source and diff --git a/build/build.tcl b/build/build.tcl index 1d5c6872..ca77e44f 100644 --- a/build/build.tcl +++ b/build/build.tcl @@ -863,6 +863,11 @@ expect ":KILL" respond "*" ":midas sys2;ts stylog_sysen1;stylog\r" expect ":KILL" +# TMPKIL +respond "*" ":midas sys2;ts tmpkil_syseng;tmpkil\r" +expect ":KILL" +respond "*" ":link dragon;hourly tmpkil,sys2;ts tmpkil\r" + # ndskdmp tape respond "*" ":link kshack;good ram,.;ram ram\r" respond "*" ":link kshack;ddt bin,.;@ ddt\r" diff --git a/src/syseng/tmpkil.12 b/src/syseng/tmpkil.12 new file mode 100644 index 00000000..858084c5 --- /dev/null +++ b/src/syseng/tmpkil.12 @@ -0,0 +1,100 @@ +title TMPKIL -- Kill files on .TEMP. directory + +a=1 +b=2 +c=3 +d=4 +e=5 +t=6 +tt=7 +sp=17 +p==sp ;to make DATIME > happy + +dski=10 + +.insrt SYSENG;FSDEFS > +.insrt RWK;SYSCAL > +datime"$$ABS==1 ;include routines for absoulute time +.insrt SYSENG;DATIME > + +pdl: -20,,. + block 20 + +dir: block 2000 +dirend: + +go: .close 1, ;runs as demon on system startup + move sp,pdl ;initialize the PDL + + skipn expire ;is this simply an old-file reap? + jrst dirget ; yes, don't bother with the time + + call datime"timget ;get the time + camn a,[-1] ;is the time unknown? + .logout 1, ; yes, don't do anything! + movn b,expire ;get expiration period + call datime"timadd ;that time ago + +dirget: syscal open,[cnti .uii ;read in the directory in image mode + argi dski + [sixbit /DSK/] + [sixbit /.FILE./] + [sixbit /(DIR)/] + [sixbit /.TEMP./]] + .lose %lsfil + + move t,[444400,,dir] ;read in the directory + movei tt,2000 ;(all 1k of it) + syscal siot,[argi dski ? t ? tt] + .lose %lsfil + .close dski, + + move d,udnamp+dir ;get relative loc of name section + addi d,dir ;make it absolute + + +chkfil: cail d,dirend ;is it the end? + jrst [skipn debug ;debugging? + .logout 1, ;all done, log out + .value ;must be debuging! + jrst .] + + move tt,unrndm(d) ;get flag word + tlnn tt,unreap ;is it not to be reaped? + tlne tt,unigfl ; or otherwise ignored? + jrst nxtfil ; yes, skip it + + ;reap + skipe expire ; are we expiring old ones only? + camle a,undate(d) ; yes, is it new? + caia ; no, gobble it down + jrst nxtfil ; yes, skip it! + +;; Here we have found a file which does not have it's don't-reap bit +;; on and is not to be ignored. Therefore we should delete it + + syscal delete,[[sixbit /DSK/] + unfn1(d) ;FN1 from directory + unfn2(d) ;FN2 from directory + [sixbit /.TEMP./]] + jrst [skipn debug ;huh? must of gone away by itself? + jrst nxtfil ; so ignore it + .value ;debuging, so let's notice the fact + jrst nxtfil] ;but continue + +nxtfil: addi d,lunblk + jrst chkfil + +vrsadr: .fnam1 + .fnam2 +debug: 0 +expire: 0 ;if nonzero, this is EXPIRE so only delete + ;files older than this many seconds ago. +second==1 +minute==60.*second +hour=60.*minute +day=24.*hour +week=7.*day +month=30.*day + +end go