Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!harvard!panda!genrad!decvax!cwruecmp!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon Allbery) Newsgroups: net.sources Subject: Detecting running processes... this one's portable Message-ID: <1325@ncoast.UUCP> Date: Sun, 27-Jul-86 10:36:31 EDT Article-I.D.: ncoast.1325 Posted: Sun Jul 27 10:36:31 1986 Date-Received: Thu, 31-Jul-86 02:56:16 EDT References: <515@cubsvax.UUCP> <212@amc.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon Allbery) Followup-To: net.sources Organization: Cleveland Public Access UNIX (ncoast), Cleveland, OH Lines: 44 Expires: Quoted from <212@amc.UUCP> ["Re: csh-script to run a job after an existing job terminates"], by stan@amc.UUCP (Stan Tazuma)... +--------------- | In article <515@cubsvax.UUCP> peters@cubsvax.UUCP (Peter S. Shenkin) writes: | >DESCRIPTION: | >after: a procedure that waits until a particular running process terminates, | > then initiates a new process. This runs under csh, but should be | > easily translatable to bsh or ksh. | > | I think it's a useful tool, but there are simpler ways to do it (at | least under a BSD Unix (which includes the Ultrix you're using)). | Here's a program I came up with a while back. It's called waitp. | It has the same args. as "after". | ------------waitp.c------------ | For AT&T Unix versions, getpgrp() doesn't behave in the above way (waitp.c). | The AT&T ps command can be used to look at a specific process, though | using a different ps argument than above. +--------------- I have another method; it works everywhere except that under System V it doesn't work to see if a process has exited and should be waited upon (this doesn't apply to an ``after'' program anyway): -------- #! /bin/sh while kill -0 ${1-?}; do sleep ${2-60} done -------- The C version is just as trivial. Note that kill -0 isn't documented in V7 or System III... then again, V7 didn't have getpgrp() that I saw, so neither method will work. ++Brandon -- ---------------- /--/ Brandon S. Allbery UUCP: / / /|\/ Tridelta Industries, Inc. decvax!cwruecmp!ncoast! ---- -------- /-++ 7350 Corporate Blvd. tdi2!brandon / / /---, /--/ Mentor, Ohio 44060 PHONE: (home) / / / / / / -- HOME -- +1 216 974 9210 / / / / / / 6615 Center St. Apt. A1-105 ARPA: ncoast!allbery% ---- /----~ /--/ Mentor, Ohio 44060-4101 case.CSNET@csnet-relay ------------------------------------------------------------------------------- Space -- The Final Frontier