[613] | 1 | ZTMB ;SEA/RDS-Taskman: Manager, Boot/ Option, ZTMRESTART ;12/21/2004 14:37
|
---|
| 2 | ;;8.0;KERNEL;**275,355**;Jul 10, 1995;Build 9
|
---|
| 3 | ;
|
---|
| 4 | ;NOTE: On DataTree systems:
|
---|
| 5 | ;For automatic startup of TaskMan at boot, save as %ustart in SYS.
|
---|
| 6 | ;In %ustart, remove ';' from the next two lines:
|
---|
| 7 | ;I $P($ZVER,"/",2)>4.0,$P($ZVER,"/",2)<4.3 VIEW 1:296:$C(2) ;increase name table allocation
|
---|
| 8 | ;I ZZSWITCH 256 ;display current namespace
|
---|
| 9 | ;
|
---|
| 10 | START ;Start Taskmanager
|
---|
| 11 | N %,X,Z,ZTOS,ZTMB,ZTUCI,ZTMODE,ZTPAIR,ZTVOL,ZTNODE,ZTMULT
|
---|
| 12 | D INIT S ZTMB="START"
|
---|
| 13 | I ZTOS["OpenM" G CACHE
|
---|
| 14 | I ZTOS["VAX DSM" G VXD
|
---|
| 15 | I ZTOS["GT.M" J START^%ZTM0 Q
|
---|
| 16 | I ZTOS["DTM" G DTM
|
---|
| 17 | I $L($T(START^%ZTM0)) J START^%ZTM0 Q
|
---|
| 18 | W !,"Taskman NOT Started"
|
---|
| 19 | Q
|
---|
| 20 | VXD S %=($ZC(%GETJPI,$J,"CURPRIV")["SHARE") I % W !,"Don't start TaskMan with the SHARE privilege" Q
|
---|
| 21 | S Z=0,%=$O(^%ZIS(14.7,"B",ZTPAIR,0)),ZTMODE=$P($G(^%ZIS(14.7,+%,0)),U,10)
|
---|
| 22 | VXD2 I Z,$$EC^%ZOSV["access not authorized"!($$EC^%ZOSV["no privilege") W !!,"You lack the system privilege to start TaskMan." H 2 Q
|
---|
| 23 | I Z,$$EC^%ZOSV'["duplicate name" W !!,"The following error has prevented TaskMan from starting:",!,$$EC^%ZOSV H 2 Q
|
---|
| 24 | S X="VXD2",@^%ZOSF("TRAP"),Z=Z+1
|
---|
| 25 | I ZTMODE="" S %=ZTMB_"^%ZTM0:(OPTION=""/UCI=""_ZTUCI,NAME=""TaskMan ""_$E(^%ZOSF(""VOL""),1,3)_"" ""_Z)" J @% Q
|
---|
| 26 | ;Remove the '/NOLOG' if you want a log file for trouble shooting
|
---|
| 27 | I $L(ZTMODE) S %SPAWN="SUBMIT/NOPRINT/NOLOG/USER=TASKMAN/QUEUE=TM$"_ZTNODE_" DHCP$TASKMAN:ZTMWDCL/PARAM=("_ZTMODE_","_(ZTMB["RE")_")" D ^%SPAWN
|
---|
| 28 | Q
|
---|
| 29 | ;
|
---|
| 30 | CACHE ;Cache or OpenM
|
---|
| 31 | I $ZV'["VMS" J START^%ZTM0:ZTUCI Q ;Non-VMS start
|
---|
| 32 | ;For Cache/VMS
|
---|
| 33 | S %=($ZF("GETJPI",$J,"PROCPRIV")["SHARE") I % W !,"Don't start TaskMan with the SHARE privilege" Q
|
---|
| 34 | S Z=0,%=$O(^%ZIS(14.7,"B",ZTPAIR,0)),ZTMODE=$P($G(^%ZIS(14.7,+%,0)),U,10)
|
---|
| 35 | I '$L(ZTMODE) J START^%ZTM0:ZTUCI Q ;Non-DCL start
|
---|
| 36 | I $L(ZTMODE) D
|
---|
| 37 | . N CONF S CONF=$P(ZTPAIR,":",2)
|
---|
| 38 | . ;Remove the '/NOLOG' if you want a log file for trouble shooting
|
---|
| 39 | . S %SPAWN="SUBMIT/NOPRINT/NOLOG/USER=TASKMAN/QUEUE=TM$"_ZTNODE_" DHCP$TASKMAN:ZTM2WDCL.COM/PARAM=("_CONF_","_ZTUCI_",0)"
|
---|
| 40 | . S %=$ZF(-1,%SPAWN)
|
---|
| 41 | Q
|
---|
| 42 | ;
|
---|
| 43 | DTM ;For DTM only
|
---|
| 44 | N DEV,NULLDEV
|
---|
| 45 | I ZTMB="START" D NULLDEV F DEV=10:1:19 O DEV:("W":NULLDEV):0 C DEV
|
---|
| 46 | S Z=0
|
---|
| 47 | DTM2 S X="DTM2",@^%ZOSF("TRAP"),Z=Z+1,%=ZTMB_"^%ZTM0:(NSPACE="""_ZTUCI_""":STRSTK=8000:LVMEM=12000:NAME=""TaskMan "_$E(^%ZOSF("VOL"),1,3)_" "_Z_""")" J @% Q
|
---|
| 48 | ;
|
---|
| 49 | RESTART ;Restart Taskmanager
|
---|
| 50 | N %,%ZTI,X,Z,ZTOS,ZTMB,ZTUCI,ZTMODE,ZTPAIR,ZTVOL,ZTNODE,ZTMULT
|
---|
| 51 | D INIT
|
---|
| 52 | I $D(^%ZOSF("SIGNOFF")) X ^("SIGNOFF") I D Q
|
---|
| 53 | . W $C(7),!,"NOTE THAT THE SYSTEM IS IN A 'SIGNOFF' STATE,",!?4,"WHICH PROBABLY EXPLAINS WHY TASKS ARE NOT RUNNING!!",!
|
---|
| 54 | S ZTMULT=0
|
---|
| 55 | I $S($D(^%ZTSCH("RUN"))[0:0,^("RUN")-$H:0,1:$P($H,",",2)-150'>$P(^("RUN"),",",2)) W !,"TASKMAN IS ALREADY RUNNING" S ZTMULT=1
|
---|
| 56 | I ZTOS["VAX DSM" I $ZC(%GETJPI,$J,"CURPRIV")["SHARE" D Q
|
---|
| 57 | . W !,"Don't start TaskMan with the SHARE privilege" Q
|
---|
| 58 | I ZTOS["OpenM",$ZV["VMS" I $ZF("GETJPI",$J,"PROCPRIV")["SHARE" D Q
|
---|
| 59 | . W !,"Don't start TaskMan with the SHARE privilege" Q
|
---|
| 60 | F %ZTI=0:0 D Q:"YESyes^NOno"[%Y
|
---|
| 61 | . W !,"ARE YOU SURE YOU WANT TO RESTART ",$S(ZTMULT:"ANOTHER ",1:""),"TASKMAN? NO//"
|
---|
| 62 | . R %Y:$S($D(DTIME)#2:DTIME,1:60) S:'$T %Y="^" Q:"YESyes^NOno"[%Y
|
---|
| 63 | . W:'$T "*TIMEOUT*" W:%Y'["?" *7 D HELP1:%Y'["??",HELP2:%Y["??"
|
---|
| 64 | I %Y=""!("YESyes"'[%Y) W " (NO)",!,*7,"<NO ACTION TAKEN>",! Q
|
---|
| 65 | W " (YES)",!,"Restarting..."
|
---|
| 66 | S ZTMB="RESTART"
|
---|
| 67 | I ZTOS["OpenM" D CACHE,DONE Q
|
---|
| 68 | I ZTOS["DTM" G DTM
|
---|
| 69 | I ZTOS["GT.M" J RESTART^%ZTM0 D DONE Q
|
---|
| 70 | I ZTOS'["VAX DSM" J RESTART^%ZTM0[ZTUCI] D DONE Q
|
---|
| 71 | I ZTOS["VAX DSM" G VXD
|
---|
| 72 | W !!,$C(7),"Taskman NOT Restared",!
|
---|
| 73 | Q
|
---|
| 74 | INIT S U="^",ZTOS=^%ZOSF("OS"),ZTUCI=$P(^%ZOSF("MGR"),",")
|
---|
| 75 | D GETENV^%ZOSV S ZTVOL=$P(Y,U,2),ZTNODE=$P(Y,U,3),ZTPAIR=$P(Y,U,4)
|
---|
| 76 | Q
|
---|
| 77 | ;
|
---|
| 78 | NULLDEV ;SELECT NULL DEVICE (DTM OS Dependent)
|
---|
| 79 | N %HW
|
---|
| 80 | D HWTYPE S NULLDEV="NUL" I %HW'="PC" S NULLDEV="[NUL]"
|
---|
| 81 | Q
|
---|
| 82 | ;
|
---|
| 83 | HWTYPE ;HARDWARE TYPE(DTM OS Dependent)
|
---|
| 84 | K %HW S %H=$S($P($ZVER,"/",2)<4:$V(4,3,-1),1:$V(1,3,-1)) ;get hardware type number
|
---|
| 85 | S %HW=$S(%H<10:"WS",%H<20:"MF",%H<64:"?",%H<129:"PC",1:"?")
|
---|
| 86 | Q
|
---|
| 87 | ;
|
---|
| 88 | HELP1 ;RESTART--improved help for the confirmation prompt.
|
---|
| 89 | W !!?5,"Answer must be YES or NO."
|
---|
| 90 | W !?5,"Answer YES to restart ",$S(ZTMULT:"another ",1:""),"TaskMan.",!
|
---|
| 91 | Q
|
---|
| 92 | ;
|
---|
| 93 | HELP2 ;RESTART--??-help for confirmation prompt
|
---|
| 94 | W !!?5,"TaskMan must be running in each library uci on the system for tasks to run."
|
---|
| 95 | W !?5,"One TaskMan per library uci should be enough for all but the busiest sites."
|
---|
| 96 | W !?5,"The System Status option and the Monitor TaskMan option can help determine"
|
---|
| 97 | W !?5,"whether a TaskMan is running on this volume set."
|
---|
| 98 | W !!?5,"If you are still uncertain how to respond, answer NO and consult your"
|
---|
| 99 | W !?5,"documentation or your support ISC.",!
|
---|
| 100 | Q
|
---|
| 101 | ;
|
---|
| 102 | DONE ;RESTART--feedback after restarting TaskMan
|
---|
| 103 | W "TaskMan restarted!",! Q
|
---|
| 104 | ;
|
---|