home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume26 / QBATCH / patch02 next >
Encoding:
Text File  |  1991-11-25  |  32.6 KB  |  994 lines

  1. Newsgroups: comp.sources.misc
  2. From: alan@tharr.uucp (Alan Saunders)
  3. Subject:  v26i070:  QBATCH - a queued batch processing system for UNIX, Patch02
  4. Message-ID: <1991Nov26.034904.1196@sparky.imd.sterling.com>
  5. X-Md4-Signature: 51416bf6930797be52e9b4981f60ebf8
  6. Date: Tue, 26 Nov 1991 03:49:04 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: alan@tharr.uucp (Alan Saunders)
  10. Posting-number: Volume 26, Issue 70
  11. Archive-name: QBATCH/patch02
  12. Environment: UNIX
  13. Patch-To: QBATCH: Volume 25, Issue 20-25
  14.  
  15. I have been unable to contact tharr for a couple of days, since they have
  16. had problems.  If anyone has had mail to me returned, could they please
  17. re-send it.. Thanks.
  18.  
  19. Should have waited a day or two more for all the response to get in before
  20. issuing p1!
  21.  
  22. Bugs:  A few more typos in config.c!  Realised I don't need to have the
  23. facilities (functions) available on my system to compile with all variations
  24. of defines to see if config.c is syntactically correct.  I've now done this,
  25. and if anyone finds more typos I'll scream!!
  26.  
  27. Long environment variables overwriting other data in js.c (and qp.c) (see
  28. changes) Environment variables were being copied into buff without a length
  29. check, changed so only (QBUFLEN-1) characters are copied.
  30.  
  31. Changes:  Length (and number) of environment variables seems to be causing
  32. most problems.  There are two new defines in Makefile:
  33.  
  34. QBUFLEN         defines the size of buffer used to grab environment variables
  35.         (amongst other things) in js, and to place them in the table
  36.         in qp.  Set it to at least 1 greater than the maximum
  37.         environment string length (including the environment name and
  38.         the '=').  Also used for reading the input file in js, so it
  39.         must also be larger than the largest input line.
  40.  
  41. QMAXENV         defines the size of the environment table passed to the
  42.         running job by qp.  Set it to at least 4 greater than the
  43.         maximum number of environment variables to be passed (3 used by
  44.         QBATCH and a trailing NULL pointer).
  45.  
  46. Also found envvar writing all over everywhere when transferring large (>255
  47. char) environment variables to the table, changed envvar to a char * pointing
  48. into buff1.
  49.  
  50. Minor cosmetic changes to qf (-s) option .. not reporting current job if it
  51. is the first one since the queue started.
  52.  
  53. 14 November 1991
  54.  
  55. Cosmetic change in logging.c.. no need for end time since:
  56.  
  57.   end time = start time + ((queued + real)/100)
  58.  
  59. so first two fields are now start date and time in a more human readable form
  60. (yyyymm/dd:HH.MM.SS)
  61.  
  62. For anyone who hasn't worked it out :-), user response time (the time between
  63. submitting a job, and the job's completion) is:
  64.  
  65.   response time = end time - start time
  66.  
  67. Alan
  68. #! /bin/sh
  69. # This is a shell archive.  Remove anything before this line, then unpack
  70. # it by saving it into a file and typing "sh file".  To overwrite existing
  71. # files, type "sh file -c".  You can also feed this as standard input via
  72. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  73. # will see the following message at the end:
  74. #        "End of archive 1 (of 1)."
  75. # Contents:  patches/qbatch.p2
  76. # Wrapped by root@vfib_d on Fri Nov 15 07:41:52 1991
  77. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  78. if test -f 'patches/qbatch.p2' -a "${1}" != "-c" ; then 
  79.   echo shar: Will not clobber existing file \"'patches/qbatch.p2'\"
  80. else
  81. echo shar: Extracting \"'patches/qbatch.p2'\" \(28288 characters\)
  82. sed "s/^X//" >'patches/qbatch.p2' <<'END_OF_FILE'
  83. Prereq: 1
  84. Index: src/patchlevel.h
  85. X***************
  86. X*** 1 ****
  87. X! #define PATCHLEVEL 1
  88. X--- 1 ----
  89. X! #define PATCHLEVEL 2
  90. Index: INSTALL
  91. X***************
  92. X*** 1,5 ****
  93. X  
  94. X!     QBATCH Version 2.0 Installation notes and bewares
  95. X  
  96. X      The QBATCH system and its related programs were
  97. X      written by Alan D. Saunders and are
  98. X--- 1,5 ----
  99. X  
  100. X!     QBATCH Version 2 Installation notes and bewares
  101. X  
  102. X      The QBATCH system and its related programs were
  103. X      written by Alan D. Saunders and are
  104. X***************
  105. X*** 32,38 ****
  106. X  where the batch files are created, again, the world should be able to
  107. X  look at the contents of these files (jcl and monitors), but only root
  108. X  should be able to create and delete them.  Also define MAILPATH and 
  109. X! SUBJECT to suit your system.
  110. X  
  111. X  If you require queue profile logging to be available, ensure that
  112. X  LOGGING is defined in qbatch.h, and check that the data being logged
  113. X--- 32,42 ----
  114. X  where the batch files are created, again, the world should be able to
  115. X  look at the contents of these files (jcl and monitors), but only root
  116. X  should be able to create and delete them.  Also define MAILPATH and 
  117. X! SUBJECT to suit your system. If necessary also change QBUFLEN to
  118. X! suit the size of environment variables passed to running jobs, and
  119. X! the length of lines in input job files.  Set QMAXENV to suit the 
  120. X! maximum number of environment variables to be passed to the job
  121. X! (including 3 extra for QBATCH and 1 for a trailing NULL pointer).
  122. X  
  123. X  If you require queue profile logging to be available, ensure that
  124. X  LOGGING is defined in qbatch.h, and check that the data being logged
  125. Index: NEWS
  126. X***************
  127. X*** 1,4 ****
  128. X!     Current release of QBATCH version 2.0 Aug 30 1991
  129. X  
  130. X      The QBATCH system and its related programs were
  131. X      written by Alan D. Saunders and are
  132. X--- 1,4 ----
  133. X!     Current release of QBATCH version 2 Aug 30 1991
  134. X  
  135. X      The QBATCH system and its related programs were
  136. X      written by Alan D. Saunders and are
  137. X***************
  138. X*** 211,214 ****
  139. X--- 211,267 ----
  140. X  
  141. X  Posted qbatch.p1 to comp.sources.misc
  142. X  
  143. X+ Current version is 2.1
  144. X+ 
  145. X  .. ADS
  146. X+ 
  147. X+ 13 November 1991
  148. X+ 
  149. X+ Should have waited a day or two more for all the response to get in before
  150. X+ issuing p1!
  151. X+ 
  152. X+ Bugs:
  153. X+ A few more typos in config.c!
  154. X+ Realised I don't need to have the facilities (functions) available on my system
  155. X+ to compile with all variations of defines to see if config.c is syntactically
  156. X+ correct.  I've now done this, and if anyone finds more typos I'll scream!!
  157. X+ 
  158. X+ Long environment variables overwriting other data in js.c (and qp.c)
  159. X+ (see changes) Environment variables were being copied into buff without a
  160. X+ length check, changed so only (QBUFLEN-1) characters are copied.
  161. X+ 
  162. X+ Changes:
  163. X+ Length (and number) of environment variables seems to be causing most problems.
  164. X+ There are two new defines in Makefile:
  165. X+ 
  166. X+ QBUFLEN        defines the size of buffer used to grab environment variables
  167. X+         (amongst other things) in js, and to place them in the table
  168. X+         in qp.  Set it to at least 1 greater than the maximum environment
  169. X+         string length (including the environment name and the '=').
  170. X+         Also used for reading the input file in js, so it must also be
  171. X+         larger than the largest input line.
  172. X+ 
  173. X+ QMAXENV        defines the size of the environment table passed to the running
  174. X+         job by qp.  Set it to at least 4 greater than the maximum
  175. X+         number of environment variables to be passed (3 used by QBATCH
  176. X+         and a trailing NULL pointer).
  177. X+ 
  178. X+ Also found envvar writing all over everywhere when transferring large (>255 char)
  179. X+ environment variables to the table, changed envvar to a char * pointing into buff1.
  180. X+ 
  181. X+ Minor cosmetic changes to qf (-s) option .. not reporting current job if it is
  182. X+ the first one since the queue started.
  183. X+ 
  184. X+ 14 November 1991
  185. X+ 
  186. X+ Cosmetic change in logging.c.. no need for end time since:
  187. X+ 
  188. X+   end time = start time + ((queued + real)/100)
  189. X+ 
  190. X+ so first two fields are now start date and time in a more human readable form
  191. X+ (yyyymm/dd:HH.MM.SS)   
  192. X+ 
  193. X+ For anyone who hasn't worked it out :-), user response time (the time between
  194. X+ submitting a job, and the job's completion) is:
  195. X+ 
  196. X+   response time = end time - start time
  197. Index: doc/Index
  198. X***************
  199. X*** 18,23 ****
  200. X--- 18,24 ----
  201. X  chap.04    USER        Commands anyone can use.
  202. X  
  203. X  chap.05    MONITORS     What they are, and how to configure and use them.
  204. X+         LOGGING         Maintain timings on a per job per queue basis.
  205. X  
  206. X  chap.06    CONFIGURATION    What needs to be done to install a working QBATCH.
  207. X  
  208. Index: doc/chap.04
  209. X***************
  210. X*** 201,206 ****
  211. X--- 201,232 ----
  212. X           Column 7 is the job name, which, if used, gives some indication
  213. X           of the job running.
  214. X           
  215. X+         JOB Names:  These are extremely useful if used regularly, particularly
  216. X+     on a heavily used system.  They allow the user to see at a glance just
  217. X+     exactly what is running, and perhaps make a fair guess (assuming he or
  218. X+     she knows how long the types of job take), at how long it will be before
  219. X+     their job will be complete.
  220. X+ 
  221. X+     The usual source of a job name is with the -n option to js, but there
  222. X+     are other options.
  223. X+ 
  224. X+     During the life of say a development project, an environment variable
  225. X+     JOBNAME=<namestring> will cause js to use <namestring> if the job name
  226. X+     is not specified with the -n option.
  227. X+ 
  228. X+     For regularly run jobs submitted as an existing file of jcl, a comment
  229. X+     line:
  230. X+     #JOBNAME=<namestring>
  231. X+     will cause js to use <namestring> in the absence of any other name.
  232. X+ 
  233. X+     In the absence of any other job name specification, js will use the
  234. X+     LAST line of the jcl submitted to it (or at least the first 30 chars)
  235. X+     as the job name.  In the case of a single command (-c option), it will
  236. X+     be the command line.
  237. X+ 
  238. X+     To add a missing job name to a queue entry, or change an existing one,
  239. X+     use 'js'.
  240. X+ 
  241. X      qf     Queue find.
  242. X      qt    Queue test. These programs are primarily provided for use in shell
  243. X      scripts.  All of the options of qf provide output on stdout relating to
  244. Index: doc/chap.05
  245. X***************
  246. X*** 164,171 ****
  247. X  
  248. X      As released, the data logged is:
  249. X  
  250. X      start time of job (time_t format)
  251. X-     end time of job (time_t format)
  252. X      user name 
  253. X      uid 
  254. X      gid 
  255. X--- 164,172 ----
  256. X  
  257. X      As released, the data logged is:
  258. X  
  259. X+     start date of job (yyyy/mm/dd)
  260. X+     start time of job (HH.MM.SS)
  261. X      start time of job (time_t format)
  262. X      user name 
  263. X      uid 
  264. X      gid 
  265. X***************
  266. X*** 179,181 ****
  267. X--- 180,195 ----
  268. X  
  269. X      fields in the record are packed (no spaces) with a colon (':') as a
  270. X      field delimiter.
  271. X+ 
  272. X+     Example: (tail -10 `qf -L work`)
  273. X+ 
  274. X+     1991/11/14:11.00.58:690116458:root:0:1:"make qbatch":100:18020:9433:6611
  275. X+     1991/11/14:11.04.47:690116687:sop:200:200:"Sales Analysis":0:7218:3690:2666
  276. X+     1991/11/14:11.06.00:690116760:sop:200:200:"Outstanding Orders":3800:4516:2291:1635
  277. X+     1991/11/14:11.06.50:690116810:sop:200:200:"Invoice Print":0:3018:1520:1101
  278. X+     1991/11/14:11.08.15:690116895:accounts:71:71:"Account Print":0:2016:1035:731
  279. X+     1991/11/14:11.09.16:690116956:payroll:99:2006:"Pay Analysis":0:5425:2643:1920
  280. X+     1991/11/14:11.10.11:690117011:root:0:1:"make install":1900:2516:1253:905
  281. X+     1991/11/14:11.11.09:690117069:payroll:99:2006:"Payslips":0:4820:2441:1755
  282. X+     1991/11/14:11.11.57:690117117:sop:200:200:"Order Acknowledgements":900:9721:4998:3550
  283. X+     1991/11/14:11.13.35:690117215:accounts:71:71:"Statements Print":5000:17318:8870:6373
  284. Index: doc/chap.07
  285. X***************
  286. X*** 67,75 ****
  287. X      User:    The user cpu time taken by the job.
  288. X      System:    The system cpu time taken by the job.
  289. X  
  290. X      Ideally, if a system is correctly tuned, the average timings of a given
  291. X      queue should only vary within limits.  Any wider variance is a reason to
  292. X!     look at the individual times in the monitors.
  293. X  
  294. X      Consistently low utilisation would probably indicate that jobs
  295. X      submitted to this queue could probably share resources better by being
  296. X--- 67,86 ----
  297. X      User:    The user cpu time taken by the job.
  298. X      System:    The system cpu time taken by the job.
  299. X  
  300. X+     For more long term monitoring of queue activity, there is the logging
  301. X+     option.  If LOGGING is defined in qbatch.h when the system is compiled,
  302. X+     and if logging is switched on for a given queue with 'qc -l <queuename>'
  303. X+     then a log record is written to the log for every job processed.  (see
  304. X+     chap.05 section 5a for details).  The data logged is defined in logging.c
  305. X+     and may be tuned to suit the system administrator.  As released, the
  306. X+     log record is designed more for analysis by a program than to be humanly
  307. X+     readable.  Where a QBATCH system is implemented to use distributed 
  308. X+     monitors (either personal monitors, or mailed monitors) then logging is
  309. X+     perhaps the only way to monitor queue performance.
  310. X+ 
  311. X      Ideally, if a system is correctly tuned, the average timings of a given
  312. X      queue should only vary within limits.  Any wider variance is a reason to
  313. X!     look at the individual times in the monitors or logs.
  314. X  
  315. X      Consistently low utilisation would probably indicate that jobs
  316. X      submitted to this queue could probably share resources better by being
  317. Index: src/Makefile
  318. X***************
  319. X*** 30,35 ****
  320. X--- 30,45 ----
  321. X  
  322. X  SUBJECT="-s"
  323. X  
  324. X+ # Buffer length (particularly for getting and setting environment variables)
  325. X+ # (js broke on some systems 'cos the original size wasn't enough)
  326. X+ 
  327. X+ QBUFLEN=1024
  328. X+ 
  329. X+ # Maximum number of environment variables passed in the environment table to the
  330. X+ # running job  (apparently 45 is not enough in some cases)
  331. X+ 
  332. X+ QMAXENV=100
  333. X+ 
  334. X  # configuration of working paths
  335. X  # N.B. Include the quotes and the trailing '/' in the defined string
  336. X  # both should be absolute paths (i.e leading '/'
  337. X***************
  338. X*** 42,50 ****
  339. X  
  340. X  CFLAG=-g 
  341. X  LDFLAG=-Bstatic
  342. X  QPATHS=-DQUEUEPATH=\"$(QUEUEPATH)\" -DSPOOLPATH=\"$(SPOOLPATH)\" \
  343. X! -DBINDIR=\"$(BINDIR)\" -DMAILPATH=\"$(MAILPATH)\" -DSUBJECT=\"$(SUBJECT)\"
  344. X  
  345. X  PROGS=jj jk jm jn jr js qa qc qd qe qf qg qh ql qp qs qt qw rc.QBATCH jobdone qa
  346. X  
  347. X  all:    $(PROGS)
  348. X--- 52,63 ----
  349. X  
  350. X  CFLAG=-g 
  351. X  LDFLAG=-Bstatic
  352. X+ 
  353. X  QPATHS=-DQUEUEPATH=\"$(QUEUEPATH)\" -DSPOOLPATH=\"$(SPOOLPATH)\" \
  354. X! -DBINDIR=\"$(BINDIR)\" -DMAILPATH=\"$(MAILPATH)\"
  355. X  
  356. X+ QDEFINES=-DSUBJECT=\"$(SUBJECT)\" -DQBUFLEN=$(QBUFLEN) -DQMAXENV=$(QMAXENV)
  357. X+ 
  358. X  PROGS=jj jk jm jn jr js qa qc qd qe qf qg qh ql qp qs qt qw rc.QBATCH jobdone qa
  359. X  
  360. X  all:    $(PROGS)
  361. X***************
  362. X*** 51,77 ****
  363. X      @echo "\n\007programs and scripts ... make complete\n"
  364. X  
  365. X  jj:    jj.c qbatch.h  config.o
  366. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o  -o $@
  367. X      chmod 06711 $@
  368. X  
  369. X  jk:    jk.c qbatch.h  config.o
  370. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o  -o $@
  371. X      chmod 06711 $@
  372. X  
  373. X  jm:    jm.c qbatch.h  config.o
  374. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o  -o $@
  375. X      chmod 06711 $@
  376. X  
  377. X  jn:    jn.c qbatch.h  config.o
  378. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o  -o $@
  379. X      chmod 06711 $@
  380. X  
  381. X  jr:    jr.c qbatch.h  config.o
  382. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o  -o $@
  383. X      chmod 06711 $@
  384. X  
  385. X  js:    js.c qbatch.h  config.o
  386. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o  -o $@
  387. X      chmod 06711 $@
  388. X  
  389. X  qa:    qagen Makefile
  390. X--- 64,90 ----
  391. X      @echo "\n\007programs and scripts ... make complete\n"
  392. X  
  393. X  jj:    jj.c qbatch.h  config.o
  394. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  395. X      chmod 06711 $@
  396. X  
  397. X  jk:    jk.c qbatch.h  config.o
  398. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  399. X      chmod 06711 $@
  400. X  
  401. X  jm:    jm.c qbatch.h  config.o
  402. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  403. X      chmod 06711 $@
  404. X  
  405. X  jn:    jn.c qbatch.h  config.o
  406. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  407. X      chmod 06711 $@
  408. X  
  409. X  jr:    jr.c qbatch.h  config.o
  410. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  411. X      chmod 06711 $@
  412. X  
  413. X  js:    js.c qbatch.h  config.o
  414. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  415. X      chmod 06711 $@
  416. X  
  417. X  qa:    qagen Makefile
  418. X***************
  419. X*** 79,126 ****
  420. X      chmod 0755 $@
  421. X  
  422. X  qc:    qc.c qbatch.h config.o
  423. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o  -o $@
  424. X      chmod 0700 $@
  425. X  
  426. X  qd:    qd.c qbatch.h  config.o
  427. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o  -o $@
  428. X      chmod 0700 $@
  429. X  
  430. X  qe:    qe.c qbatch.h  config.o
  431. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o  -o $@
  432. X      chmod 0700 $@
  433. X  
  434. X  qf:    qf.c qbatch.h
  435. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c  -o $@
  436. X      chmod 0711 $@
  437. X  
  438. X  qg:    qg.c qbatch.h  config.o
  439. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o  -o $@
  440. X      chmod 0700 $@
  441. X  
  442. X  qh:    qh.c qbatch.h  config.o
  443. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o  -o $@
  444. X      chmod 0700 $@
  445. X  
  446. X  ql:    ql.c qbatch.h
  447. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c -o $@
  448. X      chmod 0711 $@
  449. X  
  450. X  qp:    qp.c qbatch.h  config.o time.o logging.o
  451. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o time.o \
  452. X      logging.o  -o $@
  453. X      chmod 0700 $@
  454. X  
  455. X  qs:    qs.c qbatch.h  config.o
  456. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o  -o $@
  457. X      chmod 0700 $@
  458. X  
  459. X  qt:    qt.c qbatch.h
  460. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c -o $@
  461. X      chmod 06711 $@
  462. X  
  463. X  qw:    qw.c qbatch.h  config.o
  464. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $@.c config.o  -o $@
  465. X      chmod 0711 $@
  466. X  
  467. X  jobdone:    jdgen Makefile
  468. X--- 92,139 ----
  469. X      chmod 0755 $@
  470. X  
  471. X  qc:    qc.c qbatch.h config.o
  472. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  473. X      chmod 0700 $@
  474. X  
  475. X  qd:    qd.c qbatch.h  config.o
  476. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  477. X      chmod 0700 $@
  478. X  
  479. X  qe:    qe.c qbatch.h  config.o
  480. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  481. X      chmod 0700 $@
  482. X  
  483. X  qf:    qf.c qbatch.h
  484. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c  -o $@
  485. X      chmod 0711 $@
  486. X  
  487. X  qg:    qg.c qbatch.h  config.o
  488. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  489. X      chmod 0700 $@
  490. X  
  491. X  qh:    qh.c qbatch.h  config.o
  492. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  493. X      chmod 0700 $@
  494. X  
  495. X  ql:    ql.c qbatch.h
  496. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
  497. X      chmod 0711 $@
  498. X  
  499. X  qp:    qp.c qbatch.h  config.o time.o logging.o
  500. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o time.o \
  501. X      logging.o  -o $@
  502. X      chmod 0700 $@
  503. X  
  504. X  qs:    qs.c qbatch.h  config.o
  505. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  506. X      chmod 0700 $@
  507. X  
  508. X  qt:    qt.c qbatch.h
  509. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c -o $@
  510. X      chmod 06711 $@
  511. X  
  512. X  qw:    qw.c qbatch.h  config.o
  513. X!     cc $(CFLAG) $(LDFLAG) $(QPATHS) $(QDEFINES) $@.c config.o  -o $@
  514. X      chmod 0711 $@
  515. X  
  516. X  jobdone:    jdgen Makefile
  517. X***************
  518. X*** 132,144 ****
  519. X          chmod 0700 rc.QBATCH
  520. X  
  521. X  config.o:    config.c config.h qbatch.h
  522. X!         cc $(CFLAG) $(QPATHS) -c config.c
  523. X  
  524. X  time.o:        time.c config.h 
  525. X!         cc $(CFLAG) $(QPATHS) -c time.c
  526. X  
  527. X  logging.o:    logging.c config.h 
  528. X!         cc $(CFLAG) $(QPATHS) -c logging.c
  529. X  
  530. X  qbatch.h:    what.h Makefile
  531. X          touch qbatch.h
  532. X--- 145,157 ----
  533. X          chmod 0700 rc.QBATCH
  534. X  
  535. X  config.o:    config.c config.h qbatch.h
  536. X!         cc $(CFLAG) $(QPATHS) $(QDEFINES) -c config.c
  537. X  
  538. X  time.o:        time.c config.h 
  539. X!         cc $(CFLAG) $(QPATHS) $(QDEFINES) -c time.c
  540. X  
  541. X  logging.o:    logging.c config.h 
  542. X!         cc $(CFLAG) $(QPATHS) $(QDEFINES) -c logging.c
  543. X  
  544. X  qbatch.h:    what.h Makefile
  545. X          touch qbatch.h
  546. Index: src/config.c
  547. X***************
  548. X*** 134,140 ****
  549. X  int fd;
  550. X  /* check if the file is locked, return 0 if not locked, non 0 if locked */
  551. X  {
  552. X!     return (flock(fd, LOCK_EX|LOCK_NB);
  553. X  }
  554. X  #endif /* FLOCK */
  555. X  
  556. X--- 134,140 ----
  557. X  int fd;
  558. X  /* check if the file is locked, return 0 if not locked, non 0 if locked */
  559. X  {
  560. X!     return (flock(fd, LOCK_EX|LOCK_NB));
  561. X  }
  562. X  #endif /* FLOCK */
  563. X  
  564. X***************
  565. X*** 238,244 ****
  566. X  int sig;
  567. X  {
  568. X      struct sigvec actsig;
  569. X!     actsig.sv_mask) = 0
  570. X      actsig.sv_flags = 0;
  571. X      actsig.sv_handler = (HANDLER_TYPE (*)())sig;
  572. X      sigvec(sig, actsig, (struct sigvec *) NULL);
  573. X--- 238,244 ----
  574. X  int sig;
  575. X  {
  576. X      struct sigvec actsig;
  577. X!     actsig.sv_mask = 0;
  578. X      actsig.sv_flags = 0;
  579. X      actsig.sv_handler = (HANDLER_TYPE (*)())sig;
  580. X      sigvec(sig, actsig, (struct sigvec *) NULL);
  581. Index: src/config.h
  582. X***************
  583. X*** 79,92 ****
  584. X  /* above.) The variable 'had_usersig' is set in the handler so that pause  */
  585. X  /* and wait routines can check if the handler needs to be re-installed.    */
  586. X  
  587. X! /*#define SIGACTION*/    /* XPG3 */
  588. X! #define SIGSET
  589. X  /*#define SIGVEC */
  590. X  /*#define SIGNAL */
  591. X  /* the type of the handler function can vary from system to system. it is   */
  592. X  /* usually either void or int */
  593. X! /*typedef void HANDLER_TYPE;*/
  594. X! typedef int HANDLER_TYPE;
  595. X  
  596. X  /*---------------------------------------------------------------------------*/
  597. X  /* wait calls (define one of these) */
  598. X--- 79,92 ----
  599. X  /* above.) The variable 'had_usersig' is set in the handler so that pause  */
  600. X  /* and wait routines can check if the handler needs to be re-installed.    */
  601. X  
  602. X! #define SIGACTION    /* XPG3 */
  603. X! /* #define SIGSET */
  604. X  /*#define SIGVEC */
  605. X  /*#define SIGNAL */
  606. X  /* the type of the handler function can vary from system to system. it is   */
  607. X  /* usually either void or int */
  608. X! typedef void HANDLER_TYPE;
  609. X! /* typedef int HANDLER_TYPE; */
  610. X  
  611. X  /*---------------------------------------------------------------------------*/
  612. X  /* wait calls (define one of these) */
  613. Index: src/js.c
  614. X***************
  615. X*** 34,40 ****
  616. X  char *queuename;
  617. X  char jclfile[128];
  618. X  char queue[128];
  619. X! char buff [256];                            
  620. X  char rcmd [128];
  621. X  struct envlist {
  622. X      char *envptr;
  623. X--- 34,40 ----
  624. X  char *queuename;
  625. X  char jclfile[128];
  626. X  char queue[128];
  627. X! char buff [QBUFLEN];                            
  628. X  char rcmd [128];
  629. X  struct envlist {
  630. X      char *envptr;
  631. X***************
  632. X*** 203,209 ****
  633. X      {
  634. X          if (*monitor != '/') /* monitor should be full pathspec */
  635. X          { /* so add current working directory */
  636. X!             getcwd (buff, 128);
  637. X              if (buff [strlen(buff) - 1] != '/') strcat (buff, "/");
  638. X              strcat (buff, monitor);
  639. X              strcpy (monitor, buff);
  640. X--- 203,209 ----
  641. X      {
  642. X          if (*monitor != '/') /* monitor should be full pathspec */
  643. X          { /* so add current working directory */
  644. X!             getcwd (buff, QBUFLEN);
  645. X              if (buff [strlen(buff) - 1] != '/') strcat (buff, "/");
  646. X              strcat (buff, monitor);
  647. X              strcpy (monitor, buff);
  648. X***************
  649. X*** 279,285 ****
  650. X          if (fpin != NULL)
  651. X          {
  652. X              /* set up exclude environment table */
  653. X!             while (fgets(buff, 256, fpin) != NULL)
  654. X              {
  655. X                  if (buff[0] == '#') continue;
  656. X                  if (buff[0] == ' ') continue;
  657. X--- 279,285 ----
  658. X          if (fpin != NULL)
  659. X          {
  660. X              /* set up exclude environment table */
  661. X!             while (fgets(buff, QBUFLEN, fpin) != NULL)
  662. X              {
  663. X                  if (buff[0] == '#') continue;
  664. X                  if (buff[0] == ' ') continue;
  665. X***************
  666. X*** 290,296 ****
  667. X          }
  668. X          for (i=0; envp[i] != NULL; i++)
  669. X          {
  670. X!             strcpy (buff, envp[i]);
  671. X              for (j = 0; buff[j] != '='; j++){}
  672. X              buff[j] = 0;
  673. X              if (scan_envlist(root, buff) <= 0)
  674. X--- 290,299 ----
  675. X          }
  676. X          for (i=0; envp[i] != NULL; i++)
  677. X          {
  678. X!             for (j = 0; ((j < (QBUFLEN - 1)) && (envp[i][j] != 0)); j++)
  679. X!                 buff[j] = envp[i][j];
  680. X!             buff[j] = 0;
  681. X! /*            strcpy (buff, envp[i]); (overwriting data) */
  682. X              for (j = 0; buff[j] != '='; j++){}
  683. X              buff[j] = 0;
  684. X              if (scan_envlist(root, buff) <= 0)
  685. X***************
  686. X*** 330,340 ****
  687. X          unlink (jclfile);
  688. X          exit (-1);
  689. X          }
  690. X!             fgets (buff, 128, fpin);  
  691. X          if ((*buff == '#') && (buff[1] == '!') && (buff[2] == '/'))
  692. X          {
  693. X          fprintf (fpout, "%s", buff);
  694. X!         fgets   (buff, 128, fpin);
  695. X          }
  696. X          else
  697. X          {
  698. X--- 333,343 ----
  699. X          unlink (jclfile);
  700. X          exit (-1);
  701. X          }
  702. X!             fgets (buff, QBUFLEN, fpin);  
  703. X          if ((*buff == '#') && (buff[1] == '!') && (buff[2] == '/'))
  704. X          {
  705. X          fprintf (fpout, "%s", buff);
  706. X!         fgets   (buff, QBUFLEN, fpin);
  707. X          }
  708. X          else
  709. X          {
  710. X***************
  711. X*** 413,419 ****
  712. X          }
  713. X                  if (fixedcontext == 0) fputs (buff, fpout);
  714. X          *buff = 0;
  715. X!                 fgets (buff, 128, fpin);  
  716. X          }
  717. X          if ((permission == 0) && (jobuid != 0) && (jobuid != saveuid))
  718. X          {
  719. X--- 416,422 ----
  720. X          }
  721. X                  if (fixedcontext == 0) fputs (buff, fpout);
  722. X          *buff = 0;
  723. X!                 fgets (buff, QBUFLEN, fpin);  
  724. X          }
  725. X          if ((permission == 0) && (jobuid != 0) && (jobuid != saveuid))
  726. X          {
  727. X***************
  728. X*** 478,484 ****
  729. X      }
  730. X      else
  731. X      {
  732. X!         while (fgets (buff, 128, fpin) != NULL)
  733. X              {
  734. X                  fputs (buff, fpout);
  735. X                  if (*jobname == 0)
  736. X--- 481,487 ----
  737. X      }
  738. X      else
  739. X      {
  740. X!         while (fgets (buff, QBUFLEN, fpin) != NULL)
  741. X              {
  742. X                  fputs (buff, fpout);
  743. X                  if (*jobname == 0)
  744. X***************
  745. X*** 490,496 ****
  746. X                      {
  747. X                          *fcptr = 0;
  748. X                          fcptr ++;
  749. X!                         if (strcmp (buff, "JOBNAME") == 0)
  750. X                              strcpy (jobname, fcptr);
  751. X                      }
  752. X                  }
  753. X--- 493,499 ----
  754. X                      {
  755. X                          *fcptr = 0;
  756. X                          fcptr ++;
  757. X!                         if (strcmp (buff, "#JOBNAME") == 0)
  758. X                              strcpy (jobname, fcptr);
  759. X                      }
  760. X                  }
  761. Index: src/logging.c
  762. X***************
  763. X*** 15,20 ****
  764. X--- 15,21 ----
  765. X  
  766. X  #include <stdio.h>
  767. X  #include "qbatch.h"
  768. X+ #include <time.h>
  769. X  #ifdef LOGGING
  770. X  
  771. X  FILE *log;
  772. X***************
  773. X*** 24,29 ****
  774. X--- 25,31 ----
  775. X  extern time_t end_time;
  776. X  extern char *queuename;
  777. X  char buff[128];
  778. X+ struct tm *work_time;
  779. X  void q_log()
  780. X  {
  781. X      /* first let's see if we're logging */
  782. X***************
  783. X*** 42,54 ****
  784. X      }
  785. X      /* here you can add what you like to the log. I've chosen to put out */
  786. X      /* numbers as decimal representations of their internal forms for    */
  787. X!     /* easier computer analysis rather than in human readable form such  */
  788. X!     /* as converting dates and times etc.                     */    
  789. X      fprintf (log, "%lu:", ehead->qh_start); /* start time of job (time_t)*/
  790. X-     fprintf (log, "%lu:", end_time);        /* end time of job (time_t)*/
  791. X      fprintf (log, "%s:",eentry->qe_uname);  /* user name */
  792. X      fprintf (log, "%d:", eentry->qe_uid);   /* uid */
  793. X      fprintf (log, "%d:", eentry->qe_gid);   /* gid */
  794. X      fprintf (log, "%lu:", q_queued);       /* process times are in 1/100*/
  795. X      fprintf (log, "%lu:", q_real);          /* seconds (subject to the   */
  796. X      fprintf (log, "%lu:", q_user);          /* accuuracy of the clock.   */
  797. X--- 44,59 ----
  798. X      }
  799. X      /* here you can add what you like to the log. I've chosen to put out */
  800. X      /* numbers as decimal representations of their internal forms for    */
  801. X!     /* easier computer analysis.                                         */
  802. X! 
  803. X!     work_time = localtime (&ehead->qh_start);
  804. X!     strftime (buff, 24, "%Y/%m/%d:%H.%M.%S", work_time); /* readable     */
  805. X!     fprintf (log, "%s:", buff);      /* start date and start time of job */
  806. X      fprintf (log, "%lu:", ehead->qh_start); /* start time of job (time_t)*/
  807. X      fprintf (log, "%s:",eentry->qe_uname);  /* user name */
  808. X      fprintf (log, "%d:", eentry->qe_uid);   /* uid */
  809. X      fprintf (log, "%d:", eentry->qe_gid);   /* gid */
  810. X+     fprintf (log, "\"%s\":", eentry->qe_jobname); /* job name */
  811. X      fprintf (log, "%lu:", q_queued);       /* process times are in 1/100*/
  812. X      fprintf (log, "%lu:", q_real);          /* seconds (subject to the   */
  813. X      fprintf (log, "%lu:", q_user);          /* accuuracy of the clock.   */
  814. Index: src/qf.c
  815. X***************
  816. X*** 231,255 ****
  817. X              now *= 100;
  818. X              printf ("\n Available for     : %s\n" ,print_time (now, 1));
  819. X          }
  820. X!         if (head.qh_jobcount == 0)
  821. X          {
  822. X!         printf("No jobs run since queue started\n");
  823. X!         exit(0);
  824. X!         }
  825. X!         printf (" No. Jobs Processed: %d\n\n", head.qh_jobcount);
  826. X!         printf ("Times:\t\t    Actual\t\t\tAv. Per Job\n\n");
  827. X!         printf ("Queued\t\t%16s", print_time(head.qh_queued, 0));
  828. X!         printf ("        %16s\n", print_time(head.qh_queued/head.qh_jobcount, 0));
  829. X!         printf ("Real\t\t%16s", print_time(head.qh_real, 0));
  830. X!         printf ("        %16s\n", print_time(head.qh_real/head.qh_jobcount, 0));
  831. X!         printf ("User\t\t%16s", print_time(head.qh_user, 0));
  832. X!         printf ("        %16s\n", print_time(head.qh_user/head.qh_jobcount, 0));
  833. X!         printf ("System\t\t%16s", print_time(head.qh_system, 0));
  834. X!         printf ("        %16s\n", print_time(head.qh_system/head.qh_jobcount, 0));
  835. X!         if (head.qh_pid == 0) exit(0);
  836. X!         head.qh_real *= 10000;
  837. X!         head.qh_real /= now ;
  838. X!             printf("\nUtilisation (real/available) %d.%02d%%\n",(head.qh_real/100), (head.qh_real%100));
  839. X          if (head.qh_start)
  840. X          {
  841. X              then -= head.qh_start;
  842. X--- 231,254 ----
  843. X              now *= 100;
  844. X              printf ("\n Available for     : %s\n" ,print_time (now, 1));
  845. X          }
  846. X!         if (head.qh_jobcount != 0)
  847. X          {
  848. X!         printf (" No. Jobs Processed: %d\n\n", head.qh_jobcount);
  849. X!         printf ("Times:\t\t    Actual\t\t\tAv. Per Job\n\n");
  850. X!         printf ("Queued\t\t%16s", print_time(head.qh_queued, 0));
  851. X!         printf ("        %16s\n", print_time(head.qh_queued/head.qh_jobcount, 0));
  852. X!         printf ("Real\t\t%16s", print_time(head.qh_real, 0));
  853. X!         printf ("        %16s\n", print_time(head.qh_real/head.qh_jobcount, 0));
  854. X!         printf ("User\t\t%16s", print_time(head.qh_user, 0));
  855. X!         printf ("        %16s\n", print_time(head.qh_user/head.qh_jobcount, 0));
  856. X!         printf ("System\t\t%16s", print_time(head.qh_system, 0));
  857. X!         printf ("        %16s\n", print_time(head.qh_system/head.qh_jobcount, 0));
  858. X!         if (head.qh_pid == 0) exit(0);
  859. X!         head.qh_real *= 10000;
  860. X!         head.qh_real /= now ;
  861. X!         printf("\nUtilisation (real/available) %d.%02d%%\n",(head.qh_real/100), (head.qh_real%100));
  862. X!             }
  863. X!         else printf("\nNo jobs completed since queue started\n");
  864. X          if (head.qh_start)
  865. X          {
  866. X              then -= head.qh_start;
  867. Index: src/qp.c
  868. X***************
  869. X*** 11,16 ****
  870. X--- 11,17 ----
  871. X  
  872. X  #include "qbatch.h"
  873. X  #include <malloc.h>
  874. X+ #include <ctype.h>
  875. X  
  876. X  /* pointers to qp's structures for external use (in logging.c) */
  877. X  struct queue_header * ehead = &head;    
  878. X***************
  879. X*** 27,33 ****
  880. X  struct tm *jtimes;
  881. X  time_t end_time;
  882. X  char exit_message[64];
  883. X! char envflg[5], envvar[255];
  884. X  char temp[128],
  885. X     *jcl,
  886. X     *jcwd = NULL;
  887. X--- 28,34 ----
  888. X  struct tm *jtimes;
  889. X  time_t end_time;
  890. X  char exit_message[64];
  891. X! char envflg[5], * envvar;
  892. X  char temp[128],
  893. X     *jcl,
  894. X     *jcwd = NULL;
  895. X***************
  896. X*** 41,53 ****
  897. X  extern pid_t childid;
  898. X  char queue[128];
  899. X  char buff[128];
  900. X! char buff1[255];
  901. X  char path[128];
  902. X  char qbc[10];
  903. X  unsigned long q_queued, q_real, q_user, q_system;
  904. X  char qentry[12];
  905. X  char *args[10],
  906. X!    *envs[50],
  907. X     *queuename;
  908. X  
  909. X  char * print_time(val)
  910. X--- 42,54 ----
  911. X  extern pid_t childid;
  912. X  char queue[128];
  913. X  char buff[128];
  914. X! char buff1[QBUFLEN];
  915. X  char path[128];
  916. X  char qbc[10];
  917. X  unsigned long q_queued, q_real, q_user, q_system;
  918. X  char qentry[12];
  919. X  char *args[10],
  920. X!    *envs[QMAXENV],
  921. X     *queuename;
  922. X  
  923. X  char * print_time(val)
  924. X***************
  925. X*** 407,422 ****
  926. X                      args[j] = (char *) NULL;
  927. X                      strcpy (queue, "QUEUE=");
  928. X                      strcat (queue, queuename);
  929. X!             for (j=0; j< 50; j++) envs[j] = (char *) NULL;
  930. X              j = 0;
  931. X!             while (1) /* transfer environment variables (up to 46) */
  932. X                  {
  933. X!                 fgets (buff1, 255, fpin);
  934. X!                 sscanf (buff1, "%s %s", envflg, envvar);
  935. X                  if (strcmp (envflg, "#ENV")) break; /* no more */
  936. X!                 envs [j] = malloc(strlen(envvar)+1);
  937. X                  strcpy (envs[j++], envvar);
  938. X!                 if (j > 45) break; /* can't fit any more in table */
  939. X                  }
  940. X              fclose (fpin);
  941. X                      envs[j++] = queue;
  942. X--- 408,428 ----
  943. X                      args[j] = (char *) NULL;
  944. X                      strcpy (queue, "QUEUE=");
  945. X                      strcat (queue, queuename);
  946. X!             for (j=0; j< QMAXENV; j++) envs[j] = (char *) NULL;
  947. X              j = 0;
  948. X!             while (1) /* transfer environment variables (up to (QMAXENV-5)) */
  949. X                  {
  950. X!                 fgets (buff1, QBUFLEN, fpin);
  951. X!                 for (i = 0; i <4; i++) envflg[i] = buff1[i];
  952. X!                 envflg[i] = 0;
  953. X                  if (strcmp (envflg, "#ENV")) break; /* no more */
  954. X!                 for (i = 4; isspace(buff1[i]); i++){};
  955. X!                 envvar = &buff1[i];
  956. X!                 i = strlen(envvar);
  957. X!                 if (envvar[i-1] == '\n') envvar[i-1] = 0;
  958. X!                 envs [j] = malloc(i);
  959. X                  strcpy (envs[j++], envvar);
  960. X!                 if (j > (QMAXENV - 5)) break; /* can't fit any more in table */
  961. X                  }
  962. X              fclose (fpin);
  963. X                      envs[j++] = queue;
  964. END_OF_FILE
  965. if test 28288 -ne `wc -c <'patches/qbatch.p2'`; then
  966.     echo shar: \"'patches/qbatch.p2'\" unpacked with wrong size!
  967. fi
  968. # end of 'patches/qbatch.p2'
  969. fi
  970. echo shar: End of archive 1 \(of 1\).
  971. cp /dev/null ark1isdone
  972. MISSING=""
  973. for I in 1 ; do
  974.     if test ! -f ark${I}isdone ; then
  975.     MISSING="${MISSING} ${I}"
  976.     fi
  977. done
  978. if test "${MISSING}" = "" ; then
  979.     echo You have the archive.
  980.     rm -f ark[1-9]isdone
  981. else
  982.     echo You still need to unpack the following archives:
  983.     echo "        " ${MISSING}
  984. fi
  985. ##  End of shell archive.
  986. exit 0
  987.  
  988. exit 0 # Just in case...
  989. -- 
  990. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  991. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  992. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  993. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  994.