subroutine read_mail c c NU PRIME TIME FACILITY V 2.0 c Northeastern University Academic Computer Services c 360 Huntington Avenue c Boston, Mass 02115 c c David Bernardo, Author c c This is the AST routine which is called when something is written c into the communications mailbox, indicating a command to be executed. c Not all possible commands require PT_MONITOR action. c c******************************* c Change open statements to point c to appropriate places. c******************************* c common /channel/channel,ast_delivered integer*2 channel,length,cluster_num integer*4 ret_code,sys$wake,sys$canwak,sys$asctim character message*5,ret_message*5,username*12,time*23 logical ast_delivered c ret_code=sys$asctim(length,time,,) c c Indicate we've been woken up by a command. c ast_delivered=.true. ret_message='FAIL' c c Read the message in the mailbox. c read(7,5,err=10,end=8)message,username,cluster_num 5 format(a5,a12,a2) length=index(username,' ')-1 if(message.eq.'CRASH')then c c PT_MONITOR is to be stopped. Write message to operator console and c to PT_MONITOR log file. No return from MONITOR_SHUTDOWN. c call crash(ret_message) open(unit=9,name='manager:[ptdata]pt.log',status='unknown', 1 access='append',carriagecontrol='list',err=77) write(9,76)time,username,ret_message 76 format(1x,a23,1x,'Message from user ',a,':', 1 /,25x,'Monitor Shutdown requested. Return Status: ',a5) 77 close(unit=9) if(ret_message.eq.'OK')call monitor_shutdown endif if(message.eq.'LOADC')then c c Reinitialize PT_MONITOR and reload dynamic cluster data base file c from permanent cluster data base file. Note that INITIALIZE clears c all information from the tables in memory, so the next c SCAN_AND_ATTACK will fill in the tables again from c information gleaned from the system and data base files. c call initialize(ret_message) if(ret_message.eq.'OK')call reload_temp_C(ret_message) open(unit=9,name='manager:[ptdata]pt.log',status='unknown', 1 access='append',carriagecontrol='list',err=79) write(9,78,err=79)time,username,ret_message 78 format(1x,a23,1x,'Message from user ',a,':', 1 /,25x,'Load Cluster requested. Return Status: ',a5) 79 close(unit=9) endif if(message.eq.'LOADD')then c c Reinitialize PT_MONITOR and reload the default information from c the default data base file. c call initialize(ret_message) if(ret_message.eq.'OK')call reload_temp_D(ret_message) open(unit=9,name='manager:[ptdata]pt.log',status='unknown', 1 access='append',carriagecontrol='list',err=81) write(9,80,err=81)time,username,ret_message 80 format(1x,a23,1x,'Message from user ',a,':', 1 /,25x,'Load Defaults requested. Return Status: ',a5) 81 close(unit=9) endif if(message.eq.'LOADT')then c c Reinitialize PT_MONITOR and reload terminal data. c call initialize(ret_message) open(unit=9,name='manager:[ptdata]pt.log',status='unknown', 1 access='append',carriagecontrol='list',err=83) write(9,82,err=83)time,username,ret_message 82 format(1x,a23,1x,'Message from user ',a,':', 1 /,25x,'Load Terminal requested. Return Status: ',a5) 83 close(unit=9) endif if(message.eq.'LOADU')then c c Reinitialize PT_MONITOR and reload user data. c call initialize(ret_message) open(unit=9,name='manager:[ptdata]pt.log',status='unknown', 1 access='append',carriagecontrol='list',err=85) write(9,84,err=85)time,username,ret_message 84 format(1x,a23,1x,'Message from user ',a,':', 1 /,25x,'Load User requested. Return Status: ',a5) 85 close(unit=9) endif if(message.eq.'SHUT ')then c c Reinitialize PT_MONITOR and turn off monitoring of a cluster of c terminals. This was effected by PT_CONTROL changing a cluster's c status to IMMUNE. The next pass of SCAN_AND_ATTACK by the monitor c will ignore all the terminals within the cluster. c call initialize(ret_message) open(unit=9,name='manager:[ptdata]pt.log',status='unknown', 1 access='append',carriagecontrol='list',err=87) write(9,86,err=87)time,username,cluster_num,ret_message 86 format(1x,a23,1x,'Message from user ',a,':', 1 /,25x,'Shutdown Cluster ',i3,' requested. ', 2 'Return Status: ',a5) 87 close(unit=9) endif if(message.eq.'START')then c c Reinitialize PT_MONITOR and start monitoring a new cluster of c terminals. This is effected by PT_CONTROL setting a cluster's c status to MONITOR. The next pass of SCAN_AND_ATTACK will look c at the terminals within the cluster. c call initialize(ret_message) open(unit=9,name='manager:[ptdata]pt.log',status='unknown', 1 access='append',carriagecontrol='list',err=89) write(9,88,err=89)time,username,cluster_num,ret_message 88 format(1x,a23,1x,'Message from user ',a,':', 1 /,25x,'Startup Cluster ',i3,' requested. ', 1 'Return Status: ',a5) 89 close(unit=9) endif c c Reply to PT_CONTROL either OK or FAIL through the mailbox. c 7 write(7,6,err=15)ret_message 6 format(a5) c c Read mailbox again in case more messages. If not, cancel the c outstanding wakeup (scheduled for an unknown time in the future) c and wakeup immediately to force SCAN_AND_ATTACK to execute c and update conditions. c read(7,5,err=10,end=8)message,username,cluster_num 8 ret_code=sys$canwak(,) ret_code=sys$wake(,) return c c Errors come here; no return from MONITOR_SHUTDOWN c 10 write(7,6,err=15)ret_message 15 call send_oper_mess(6) call monitor_shutdown end