xref: /csrg-svn/usr.bin/uucp/vms/uucico.com (revision 62413)
1*48676Sbostic$ !
2*48676Sbostic$ ! Deal with requests for UUCICO
3*48676Sbostic$ !
4*48676Sbostic$ set noon
5*48676Sbostic$ set proc/prio=4
6*48676Sbostic$ set prot=w:re/default
7*48676Sbostic$ assign nla0: sys$print	! Keep those log file coming in
8*48676Sbostic$ !
9*48676Sbostic$ ! Define Key Parameters & commands
10*48676Sbostic$ !
11*48676Sbostic$ UUCICO_DIR = "e$disk:[eunice.usr.lib.uucp]"
12*48676Sbostic$ UUCICO_RESUBMIT_PERIOD = "+3:00:00"
13*48676Sbostic$ UUCICO_QUEUE = "SYS$SPECIAL"
14*48676Sbostic$ uucico:==$'UUCICO_DIR'uucico uucico
15*48676Sbostic$ status = 1
16*48676Sbostic$ !drain:==$e$disk:[eunice.usr.lib.uucp]drain drain
17*48676Sbostic$ !
18*48676Sbostic$ on error then $ goto error_mail	! If there is a problem go tell the Boss
19*48676Sbostic$ !
20*48676Sbostic$ ! Delete JOBID file (means JOB running)
21*48676Sbostic$ delete 'UUCICO_DIR'uucico.jid;*
22*48676Sbostic$ oncethrough = 0
23*48676Sbostic$ Old_UUCICO_Command := "NEVER LIKELY TO BE IDENTICAL"
24*48676Sbostic$!
25*48676Sbostic$! Main loop.  Get command file arguments and execute UUCICO.
26*48676Sbostic$!
27*48676Sbostic$ANOTHER_CMD_FILE:
28*48676Sbostic$ UUCICO_CMD_FILE = F$SEARCH(UUCICO_DIR + "uucico.dat;*")
29*48676Sbostic$ open/read/error=NO_COMMAND_FILE cmd_file 'UUCICO_DIR'uucico.dat
30*48676Sbostic$ read cmd_file UUCICO_Command /end=EMPTY_COMMAND_FILE
31*48676Sbostic$EMPTY_COMMAND_FILE:
32*48676Sbostic$ close cmd_file
33*48676Sbostic$ delete 'UUCICO_CMD_FILE'	! Delete the UUCICO command file just read
34*48676Sbostic$ goto RUN_CICO
35*48676Sbostic$!
36*48676Sbostic$NO_COMMAND_FILE:
37*48676Sbostic$ if oncethrough .eq. 1 then $ goto RESUBMIT
38*48676Sbostic$ UUCICO_Command:="-r1"		! Default command = "look for work" (Once only)
39*48676Sbostic$!
40*48676Sbostic$RUN_CICO:
41*48676Sbostic$ if Old_UUCICO_Command .eqs. UUCICO_Command then $ goto ANOTHER_CMD_FILE
42*48676Sbostic$ ! allocate dedicated lines
43*48676Sbostic$ !alloc ttd0:
44*48676Sbostic$ uucico 'UUCICO_Command'		!Run UUCICO
45*48676Sbostic$ status = $status
46*48676Sbostic$ ! Clear up terminal lines
47*48676Sbostic$ !drain ttd0:
48*48676Sbostic$ oncethrough = 1
49*48676Sbostic$ Old_UUCICO_Command = UUCICO_Command
50*48676Sbostic$ goto ANOTHER_CMD_FILE
51*48676Sbostic$!
52*48676Sbostic$error_mail:
53*48676Sbostic$ set noon	! Push through regardless...
54*48676Sbostic$ count = 0
55*48676Sbostic$ status = $STATUS
56*48676Sbostic$ subject = ""
57*48676Sbostic$mail_error:
58*48676Sbostic$ subject = subject + F$LOG("SYS$NODE")
59*48676Sbostic$ subject = subject + "UUCICO error: " + F$STRING(STATUS)
60*48676Sbostic$ subject = subject + " = "
61*48676Sbostic$ subject = subject + F$MESSAGE(STATUS)
62*48676Sbostic$ subject = subject + " " + UUCICO_COMMAND
63*48676Sbostic$ dis_list = UUCICO_DIR + "Disaster.DIS"
64*48676Sbostic$ dis_list = F$PARSE(dis_list)
65*48676Sbostic$ if dis_list .eqs. "" then $ dis_list = "SYSTEM"
66*48676Sbostic$ dis_list = F$SEARCH(dis_list)
67*48676Sbostic$ if dis_list .eqs. "" then $ dis_list = "SYSTEM"
68*48676Sbostic$ if F$LOCATE(".DIS",dis_list) .lt. F$Length(dis_list) then -
69*48676Sbostic	$ dis_list = "@" + dis_list
70*48676Sbostic$ MAIL NL: "''DIS_LIST'" /Subject="''subject'"
71*48676Sbostic$ if .not. $status then $ MAIL nl: SYSTEM -
72*48676Sbostic	/subject="UUCICO error mailing error ''STATUS' / ''$status'"
73*48676Sbostic$ !
74*48676Sbostic$RESUBMIT:
75*48676Sbostic$ if status then $ purge sys$login:uucico.log/keep=2
76*48676Sbostic$ ! Submit the job again later (Delta = defined above)
77*48676Sbostic$ assign 'UUCICO_DIR'uucico.jid sys$output
78*48676Sbostic$ submit 'UUCICO_DIR'uucico -
79*48676Sbostic	/after="''UUCICO_RESUBMIT_PERIOD'" -
80*48676Sbostic	/queue='UUCICO_QUEUE' /keep/noprint
81*48676Sbostic$ status = $status
82*48676Sbostic$ deassign sys$output
83*48676Sbostic$ !
84*48676Sbostic$ if status then $ exit
85*48676Sbostic$ if "''count'" .eqs. "" then $ count = 0
86*48676Sbostic$ if count .gt. 3 then $ exit
87*48676Sbostic$ count = count + 1
88*48676Sbostic$ subject = "Requeue Error:"
89*48676Sbostic$ goto mail_error
90*48676Sbostic$ exit
91