home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
prgramer
/
rexx
/
rdebug
/
profile.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-03-25
|
3KB
|
120 lines
/* PROFILE.REX 06-08-92 22:47 */
/* run certain housekeeping chores.*/
/* check status of last session */
/* check whether new day */
/* If new day run certain chores */
/* On daily, weekly, or bi-weekly cycle */
If arg(1)='?' Then Exit tell('profile')
trace ?r
Arg option runday
Parse Source sys .
sys.=0
If sys='OS/2' Then sys.os2=1
Else If sys='PCDOS' Then sys.dos=1
Call initial
Call any_autosave
Call checknewday
If newday? Then Call daily
Else Do
If n=1 Then Call crash_event
Else Call every_time_on
End
Exit
ANY_AUTOSAVE:
If state('c:\alert') = 0 Then Do
Say 'Searching For autosave files...'
'dir \*.aus /s > \aus'
If rc<>0 Then Return
autos='\aus'
Call lineout autos
Do 6
line= linein(autos)
End
If word(line,2)<>'Not' Then Do
Queue 'EMSG The following autosave files exist'
'X' autos; End
Call dosDEL 'c:\ALERT'
Call dosDEL AUtoS
End
Return; CRASH_EVENT:
rexx path2'CHORES2' 'chkdsk'
EVERY_TIME_ON:
Return; DAILY:
rexx path2'CHORES2' 'chkdsk'
Return; SUN1:
SUN2:
Return; MON1:
rexx path2'CHORES2' 'clean'/* every 2nd week */
Return; MON2:
Return; TUE1:
Return; TUE2:
Return; WED1:
Return; WED2:
rexx path2'CHORES2 cleanup'
Return; THU1:
THU2:
rexx path2'CHORES2' 'checkcom' /* verify command.com */
Return; FRI1:
Return; FRI2:
Return; SAT1:
Return; SAT2:
Return; CHECKNEWDAY:
newday?=0
date=date('u')
list='SUN MON TUE WED THU FRI SAT'
file='c:\LASTDATE.ON'
Call lineout file
schedule=linein(file)
Call lineout file
Parse Value date('u') With mo '/' day '/' yr
If yr>80 Then year='19'yr
Else year='20'yr
dayname=translate(left(date('w'),3))
i=wordpos(dayname,list)
dow=i-1
next=(dow+1)//7
If option='SOD' Then Call newday dayname
Else If schedule<>dayname & schedule<> 'SCHEDULE' Then Call newday dayname
Return; NEWDAY:
Arg runday
newday?=1
Say 'Last Session was:' schedule
Call lineout file
'erase' file '>nul'
Call lineout file, dayname
Call lineout file
bi_week=((day%7)//2)+1
Interpret 'Call' runday''bi_week
i=wordpos(schedule,list)
dayssincebkup=(dow+8-i)//7
Return; STATE:
/* To provide compatibility With state module in Cms & OS2 */
Arg specs
If sys.dos Then Do
If lines(specs) Then src=1
else src=28; end
else if sys.os2 then do /*O*/
If lines(specs) Then src=1
else src=28; end
Else 'STATE' specs
Return src
INITIAL:
If sys.DOS Then Do
userid = translate(dosenv('USERID'))
rexx='C:\rexx.exe'
path2='C:\mya\'
path='F:\'; End
Else Do
rexx='call'
path2='c:\rdebug\'
path='c:\rdebug\'
userid=''; End
Return 0