Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Running two command at the same time Post 302147431 by vino on Tuesday 27th of November 2007 03:04:39 AM
Old 11-27-2007
Quote:
Originally Posted by gus2000
On the Unixes I use, "ps $PID" will return non-zero when $PID is not in the process table. It may be that your Unix does not, in which case you must use some form of "ps $PID | grep" to determine if the background process has completed.
Or

Code:
while kill -0 $PID 2> /dev/null
do
  echo $PID still alive
done

 

10 More Discussions You Might Find Interesting

1. Programming

running a program for a specified time

how can i run a program for a specified time? i need to print a current time during program execution. (3 Replies)
Discussion started by: prosputko
3 Replies

2. UNIX for Dummies Questions & Answers

Differences between time command and usr/bin/time

I wondered if someone could point out the differences between the time commmand and usr/bin/time and the accuracy one might have over another. Also, is there a website or two a person could maybe link for me to describe the differences? Thank you for your time. (2 Replies)
Discussion started by: icedrake
2 Replies

3. Solaris

Slow while running a command for the first time

I am facing a performance problem on a Solaris 10 Sparc V890 server, it is an old one I know. The first time we realized there is a problem with the server, is the time when ftp transfers are made. There were 4 other identical servers doing much better. Network drivers are checked and there... (3 Replies)
Discussion started by: royalliege
3 Replies

4. Shell Programming and Scripting

Running a process based on time

Hello All, My script is nearly complete, there is just one last piece that needs to be added in. I need to check for the time, and if it is lets say for example. Sunday at 5:00AM, my script cannot run. I would assume it would be something like this, parden the terrible pseudocode ... (7 Replies)
Discussion started by: jeffs42885
7 Replies

5. Shell Programming and Scripting

Running Cron -- same time jobs

Hi Is it possible to run different cron jobs at the same time? It appears that when I run ones at 15 min granularity that they may prevent ones running later in the day. Should crons run at same time have impact on one another? (4 Replies)
Discussion started by: rob171171
4 Replies

6. Shell Programming and Scripting

Help in running a script after a particular time

Unix Gurus, I have a requirement where the shell script needs to do specific tasks after certain period of time. Daily we receive few files in a particular folder. The script does the file renaming, pass parameters to run some web services and pushes to remote FTP location. But my... (3 Replies)
Discussion started by: shankar1dada
3 Replies

7. Solaris

Please help why my Crontab is not running on time?

I have set up my cron job on the solaris SunOS 5.10 Generic_138888-03 sun4u sparc SUNW,UltraAX-i2 but it is not running on time as expected. Would you please help me to find out what I did wrong? I want to have this cron job run once every month on the 1st Wednesday of the month, but it ran... (6 Replies)
Discussion started by: ggcc
6 Replies

8. Shell Programming and Scripting

Setting time for running of the script

Dear all, I wonder if it is possible that we can run the script from time to time..I meant, it should repeat the sourcing of the script by itself? In my case, I need to source this script manually from time to time, like once in every 10 minutes. emily, (2 Replies)
Discussion started by: emily
2 Replies

9. Shell Programming and Scripting

Calculating the running time

Hi All, I want to run a utility for all the process id that are running for more than 15 mins. I have captured process id's and the time that they were run in a file like below 1st column represnts the process ids and the 2nd one is the Time < 21014 01:00 21099 01:00 24361 01:03 24406... (5 Replies)
Discussion started by: r_t_1601
5 Replies

10. UNIX for Beginners Questions & Answers

Many processes running at the same time

Hello everybody , I launched cron to execute a task every hour but the job takes more than hour that's why I'm getting more than 1000 cron processes running at the same time !!! My question is how to tell cron not to execute unless the job terminated in order to have only one process running .... (14 Replies)
Discussion started by: beautymind
14 Replies
PDFORK(2)						      BSD System Calls Manual							 PDFORK(2)

NAME
pdfork, pdgetpid, pdkill, pdwait4 -- System calls to manage process descriptors LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <sys/procdesc.h> pid_t pdfork(int *fdp, int flags); int pdgetpid(int fd, pid_t *pidp); int pdkill(int fd, int signum); int pdwait4(int fd, int *status, int options, struct rusage *rusage); DESCRIPTION
Process descriptors are special file descriptors that represent processes, and are created using pdfork(), a variant of fork(2), which, if successful, returns a process descriptor in the integer pointed to by fdp. Processes created via pdfork() will not cause SIGCHLD on termina- tion. pdfork() can accept the flags: PD_DAEMON Instead of the default terminate-on-close behaviour, allow the process to live until it is explicitly killed with kill(2). This option is not permitted in capsicum(4) capability mode (see cap_enter(2)). pdgetpid() queries the process ID (PID) in the process descriptor fd. pdkill() is functionally identical to kill(2), except that it accepts a process descriptor, fd, rather than a PID. pdwait4() behaves identically to wait4(2), but operates with respect to a process descriptor argument rather than a PID. The following system calls also have effects specific to process descriptors: fstat(2) queries status of a process descriptor; currently only the st_mode, st_birthtime, st_atime, st_ctime and st_mtime fields are defined. If the owner read, write, and execute bits are set then the process represented by the process descriptor is still alive. poll(2) and select(2) allow waiting for process state transitions; currently only POLLHUP is defined, and will be raised when the process dies. Process state transitions can also be monitored using kqueue(2) filter EVFILT_PROCDESC; currently only NOTE_EXIT is implemented. close(2) will close the process descriptor unless PD_DAEMON is set; if the process is still alive and this is the last reference to the process descriptor, the process will be terminated with the signal SIGKILL. RETURN VALUES
pdfork() returns a PID, 0 or -1, as fork(2) does. pdgetpid() and pdkill() return 0 on success and -1 on failure. pdwait4() returns a PID on success and -1 on failure. ERRORS
These functions may return the same error numbers as their PID-based equivalents (e.g. pdfork() may return the same error numbers as fork(2)), with the following additions: [EINVAL] The signal number given to pdkill() is invalid. [ENOTCAPABLE] The process descriptor being operated on has insufficient rights (e.g. CAP_PDKILL for pdkill()). SEE ALSO
close(2), fork(2), fstat(2), kill(2), poll(2), wait4(2), capsicum(4), procdesc(4) HISTORY
The pdfork(), pdgetpid(), pdkill() and pdwait4() system calls first appeared in FreeBSD 9.0. Support for process descriptors mode was developed as part of the TrustedBSD Project. AUTHORS
These functions and the capability facility were created by Robert N. M. Watson <rwatson@FreeBSD.org> and Jonathan Anderson <jonathan@FreeBSD.org> at the University of Cambridge Computer Laboratory with support from a grant from Google, Inc. BUGS
pdwait4() has not yet been implemented. BSD
April 7, 2014 BSD
All times are GMT -4. The time now is 08:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy