%%s 0/0/0 %%d D 1.1 25-Mar-82 12:13:01 v1.1 1 0 %%c Version 1.1 is the Spring 1982 Distribution of the LBL/Hughes release %%c of the Software Tools Virtual Operating System software and documentation. %%T %%I 1 #-h- sched.r 1408 asc 25-mar-82 08:35:20 v1.1 (sw-tools v1.1) #-h- defns 87 asc 25-mar-82 08:34:55 v1.1 (sw-tools v1.1) define(DEFAULTREPS,1) define(DEFAULTSECS,1) define(MINREPS,1) define(MAXREPS,HUGE) #-h- main 1175 asc 25-mar-82 08:34:57 v1.1 (sw-tools v1.1) DRIVER(sched) integer found, reps, secs, i, getarg, j, n, ctoi, length, spawn, astart integer loccom character arg(MAXLINE), proces(FILENAMESIZE), descr(PIDSIZE), clower string suffix IMAGE_SUFFIX string sh "sh" string args(ARGBUFSIZE) "sh -c " string usestr "usage: sched [-r] [-t] @"shell command@"" call query(usestr) astart = length(args) + 1 found = NO reps = DEFAULTREPS secs = DEFAULTSECS for (i=1; getarg(i, arg, MAXLINE) != EOF; i=i+1) if (arg(1) == '-' & clower(arg(2)) == 'r') { j = 3 n = ctoi(arg, j) if (n < MINREPS) reps = MINREPS else if (n > MAXREPS) reps = MAXREPS else reps = n } else if (arg(1) == '-' & clower(arg(2)) == 't') { j = 3 secs = ctoi(arg, j) } else { found = YES call scopy(arg, 1, args, astart) } if (found == NO) call error(usestr) call impath(arg) # get standard image search path if (loccom(sh, arg, suffix, proces) != BINARY) call error("Error locating shell image file.") for (i=1; i <= reps; i=i+1) { call sleep(secs) if (spawn(proces, args, descr, WAIT) == ERR) call error("Error in spawning command") } DRETURN end #-h- sched.fmt 745 asc 25-mar-82 08:35:22 v1.1 (sw-tools v1.1) .so ~bin/manhdr .hd Sched (1) 29-Oct-80 a way to repetitively invoke a command .sy sched [-r] [-t] "shell command" .ds sched causes the command typed in quotes to be repetitively invoked. The defaults are to invoke the command once, and to wait 1 second before each invocation. This utility is quite nice for statistics gathering, since sched may be run in the background, with the diagnostic output being appended to some log file. For example: .ce % sched -r144 -t600 "who | lcnt >>usrcnt" would generate a log of the number of users on the system for one day, running at 10-minute intervals. The resulting list of numbers could then be fed to a suitable analysis or plotting program. .fl .sa .di .au Joe Sventek .bu %%E 1