Sponsored Content
Full Discussion: Stateless process
Top Forums Shell Programming and Scripting Stateless process Post 302853107 by MDominok on Friday 13th of September 2013 08:32:37 AM
Old 09-13-2013
Stateless process

Hi Folks

I'm trying to monitor that a process is running, using ps.

Astonishingly the process, which is checked every 15 minutes, is runnnig but without a state about 2-3 times a day.

Extract from the script :
Code:
#!/bin/ksh

# edii_pid is PID of process to monitor.

# Checking if pid is listed in hosts processes.
# tr used for getting rid of potential leading blanks.
edii_pid_listed=`ps -p ${edii_pid} -o pid | grep -v "^  PID" | tr -d ' '`

if [[ ${edii_pid_listed} != ${edii_pid} ]]; then
  # So PID is listed, exists. In fact the process/application is runnig
  # for several days continuously.

  # Checking if pid is in running (=0) state.
  # tr used for getting rid of potential leading blanks.
  edii_pid_runnning=`ps -p ${edii_pid} -o s | grep -v "^S" | tr -d ' '`
  if [[ ${edii_pid_runnning} != 'O' ]]; then
    print "${edii_pid} isn't in running (O) state but ${edii_pid_runnning}!" 
  fi
fi

And for about 2-3 times a day i get this :
Code:
PID 2939 isn't in running (O) state but !

Any hints why a process that is running for days, has been "seen" in list of processes only microseconds before querying the state is stateless?

System is SunOS 5.10 Generic_148888-03 sun4v sparc SUNW,SPARC-Enterprise-T5220

Cheers

Michael
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. Homework & Coursework Questions

Protect service with statefull, stateless

how to protect service dns with filtering tables (statefull, stateless)? iptables -L iptables ...? (1 Reply)
Discussion started by: nini
1 Replies

5. 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

6. 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

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... (6 Replies)
Discussion started by: naveeng
6 Replies

8. 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

9. 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
dpid.h(3)							     libdaemon								 dpid.h(3)

NAME
dpid.h - Contains an API for manipulating PID files. SYNOPSIS
#include <sys/types.h> Defines #define DAEMON_PID_FILE_KILL_WAIT_AVAILABLE 1 This variable is defined to 1 iff daemon_pid_file_kill_wait() is supported. Typedefs typedef const char *(* daemon_pid_file_proc_t )(void) Prototype of a function for generating the name of a PID file. Functions const char * daemon_pid_file_proc_default (void) A function for creating a pid file name from daemon_pid_file_ident. int daemon_pid_file_create (void) Creates PID pid file for the current process. int daemon_pid_file_remove (void) Removes the PID file of the current process. pid_t daemon_pid_file_is_running (void) Returns the PID file of a running daemon, if available. int daemon_pid_file_kill (int s) Kills a running daemon, if available. int daemon_pid_file_kill_wait (int s, int m) Similar to daemon_pid_file_kill() but waits until the process died. Variables const char * daemon_pid_file_ident Identification string for the PID file name, only used when daemon_pid_file_proc is set to daemon_pid_file_proc_default(). daemon_pid_file_proc_t daemon_pid_file_proc A function pointer which is used to generate the name of the PID file to manipulate. Detailed Description Contains an API for manipulating PID files. Definition in file dpid.h. Define Documentation #define DAEMON_PID_FILE_KILL_WAIT_AVAILABLE 1 This variable is defined to 1 iff daemon_pid_file_kill_wait() is supported. Since: 0.3 See also: daemon_pid_file_kill_wait() Definition at line 82 of file dpid.h. Typedef Documentation typedef const char*(* daemon_pid_file_proc_t)(void) Prototype of a function for generating the name of a PID file. Definition at line 37 of file dpid.h. Function Documentation int daemon_pid_file_create (void) Creates PID pid file for the current process. Returns: zero on success, nonzero on failure Examples: testd.c. pid_t daemon_pid_file_is_running (void) Returns the PID file of a running daemon, if available. Returns: The PID or negative on failure Examples: testd.c. int daemon_pid_file_kill (int s) Kills a running daemon, if available. Parameters: s The signal to send Returns: zero on success, nonzero on failure int daemon_pid_file_kill_wait (int s, int m) Similar to daemon_pid_file_kill() but waits until the process died. This functions is new in libdaemon 0.3. The macro DAEMON_PID_FILE_KILL_WAIT_AVAILABLE is defined iff libdaemon supports this function. Parameters: s The signal to send m Seconds to wait at maximum Returns: zero on success, nonzero on failure (timeout condition is considered a failure) Since: 0.3 See also: DAEMON_PID_FILE_KILL_WAIT_AVAILABLE Examples: testd.c. const char* daemon_pid_file_proc_default (void) A function for creating a pid file name from daemon_pid_file_ident. Returns: The PID file path int daemon_pid_file_remove (void) Removes the PID file of the current process. Returns: zero on success, nonzero on failure Examples: testd.c. Variable Documentation const char* daemon_pid_file_ident Identification string for the PID file name, only used when daemon_pid_file_proc is set to daemon_pid_file_proc_default(). Use daemon_ident_from_argv0() to generate an identification string from argv[0] Examples: testd.c. daemon_pid_file_proc_t daemon_pid_file_proc A function pointer which is used to generate the name of the PID file to manipulate. Points to daemon_pid_file_proc_default() by default. Author Generated automatically by Doxygen for libdaemon from the source code. Version 0.14 17 Jan 2010 dpid.h(3)
All times are GMT -4. The time now is 02:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy