Sponsored Content
Top Forums Shell Programming and Scripting How to get process id of called process Post 302144923 by matrixmadhan on Monday 12th of November 2007 01:38:31 AM
Old 11-12-2007
Quote:
I don't want to call s2.sh in the background, even if i did, by the time i use ps command to find the pid value, the s2.sh might have already finished in no time.
No need to use ps,

use echo $!

this would give the pid of the last background process and there is no constraint that the background process should be executing while echo $! value is retrieved
 

10 More Discussions You Might Find Interesting

1. SCO

Identifiy and Kill Idle Unix(SCO) Process called externally

Hi, Please let us know of any possiblity of identifying and killing unix proces invoked externally (by an external tool which does not create a session). 'who' command gives idle time of sessions. But what we are looking for is idle time of a process. 'ps' command gives the elapsed/running... (1 Reply)
Discussion started by: vbalajis
1 Replies

2. Programming

display in a child process a command called in the parent one

Hi , Could you tell me if I am right 1. Using fork(), pipe(), execlp() and dup() (see man 2 dup), write a C program executing the command ps -j in a parent process, displaying the result in a child process. #include <unistd.h> #include <errno.h> #include <stdio.h> #include <unistd.h>... (7 Replies)
Discussion started by: remid1985
7 Replies

3. Shell Programming and Scripting

script to monitor process running on server and posting a mail if any process is dead

Hello all, I would be happy if any one could help me with a shell script that would determine all the processes running on a Unix server and post a mail if any of the process is not running or aborted. Thanks in advance Regards, pradeep kulkarni. :mad: (13 Replies)
Discussion started by: pradeepmacha
13 Replies

4. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

5. Shell Programming and Scripting

script to monitor the process system when a process from user takes longer than 15 min run.

get email notification from from system when a process from XXXX user takes longer than 15 min run.Let me know the time estimation for the same. hi ,any one please tell me , how to write a script to get email notification from system when a process from as mentioned above a xxxx user takes... (1 Reply)
Discussion started by: kirankrishna3
1 Replies

6. BSD

Process remians in Running state causing other similar process to sleep and results to system hang

Hi Experts, I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state. On doing cat /proc/<pid>wchan showing the "__init_begin" in the output. Can you please help me here... (0 Replies)
Discussion started by: naveeng
0 Replies

7. UNIX for Advanced & Expert Users

Process remians in Running state causing other similar process to sleep and results to system hang

Hi Experts, I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state. On doing cat /proc/<pid>wchan showing the "__init_begin" in the output. Can you please help me here... (1 Reply)
Discussion started by: naveeng
1 Replies

8. UNIX for Advanced & Expert Users

Process remians in Running state causing other similar process to sleep and results to system hang

Hi Experts, I am facing one problem here which is one process always stuck in running state which causes the other similar process to sleep state . This causes my system in hanged state. On doing cat /proc/<pid>wchan showing the "__init_begin" in the output. Can you please help me here... (6 Replies)
Discussion started by: naveeng
6 Replies

9. Shell Programming and Scripting

Monitoring processes in parallel and process log file after process exits

I am writing a script to kick off a process to gather logs on multiple nodes in parallel using "&". These processes create individual log files. Which I would like to filter and convert in CSV format after they are complete. I am facing following issues: 1. Monitor all Processes parallelly.... (5 Replies)
Discussion started by: shunya
5 Replies

10. Shell Programming and Scripting

Command to get exact tomcat process I am running ignoring other java process

Team, I have multiple batchjobs running in VM, if I do ps -ef |grep java or tomcat I am getting multiple process list. How do I get my exact tomcat process running and that is unique? via shell script? (4 Replies)
Discussion started by: Ghanshyam Ratho
4 Replies
cmrunserv(1m)															     cmrunserv(1m)

NAME
cmrunserv - run a service from the high availability package run script SYNOPSIS
cmrunserv [-v] service_name service_command_string cmrunserv [-v] [-r restarts] service_name service_command_string cmrunserv [-v] [-R] service_name service_command_string DESCRIPTION
cmrunserv is used in the high availability package run script to run a service. To start package's service, a user must either be superuser(UID=0), or have an access policy of FULL_ADMIN allowed in the cluster configu- ration file. See access policy in cmquerycl(1m) or cmmakepkg(1m). If the service process dies, cmrunserv updates the status of the service to down. The cluster software will recognize the change in status and execute the normal package recovery sequence. This includes executing the package halt script, determining if the package can be run on a different node, and, if so, executing the package run script on the new node. Should the service_command be halted by the cmhaltserv command, a SIGTERM signal will be sent to the process. This executable or shell script should be able to handle a SIGTERM signal and execute a graceful shutdown performing any cleanup necessary. If the process ignores the SIGTERM, a SIGKILL will be sent to the process. If a SIGKILL is sent, the process will die immediately and will be unable to perform any cleanup. Options cmrunserv supports the following options. -v Verbose output will be displayed. -r restarts Indicates that the service should be automatically restarted by the cluster software if it fails, without halting the package. restarts indicates how many times the service may fail before the package should be halted. -R Indicates the service should be restarted an unlimited number of times if it fails. service_name Name of the service as it exists in the package configuration information. service_command_string Process string to be started. This includes the process name and any arguments necessary for the process to run. The process name must be a full path, may be either a command name or a shell script, and must be executable. RETURN VALUE
cmrunserv returns the following values: 0 Successful completion. 1 Command failed. EXAMPLES
To run the service command string /var/opt/db/database1 under the service name db1, do the following: # Run the process /var/opt/db/database1 cmrunserv db1 /var/opt/db/database1 This line should only be executed within a package run script. AUTHOR
cmrunserv was developed by HP. SEE ALSO
cmhaltserv(1m), cmquerycl(1m), cmmakepkg(1m), cmmodnet(1m). Requires Optional Serviceguard Software cmrunserv(1m)
All times are GMT -4. The time now is 07:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy