I have to check daily 20 processes each day. The names are like Network1 Network2 Network3 ....... Network20.
There is built in utility for doing this. Following is the command to check a single network process.
check_process_status 1
If we want to check the status of Network2 then the commands is
check_process_status 2
If network process is running then this command gives a very long o/p.
But if that process is hanged or having some problems then the command will not give any o/p. The session will remain ideal until I press Ctrl+C
How can find the network processes which are hanged. I need to get the process name for which
check_process_status
dont give any o/p and gets stuck there. Checking for 20 processes daily is tedious job. Please help me
Unless you give us more details, answers will be vague as well.
You could run all checks in background, with output redirection, and check the output file size after some time. You also could check the process list for that 20 processes and see what state they are in to decide which are running and which are hung.
Thanks for your reply. While checking it manauly i do following. Lets assume i am checking Network2 process following is the command.
check_process_status 2
After entering the command i wait for 4-5 seconds. If the output (which is very long) doesn't come then i have to enter ctrl+c to come back to command prompt of UNIX.
I want to find out for which processes this scenario is happening. i.e. I want to find out for which processes i would have pressed ctrl+c.
Thanks for your reply.
Just wanted to confirm: I am working in Ksh. So will that command work?
alarm 15 will wait for 15 sec ?
Also what is pkill command is used for? does it act like ctrl+c ?
Sorry but i am new to shell scripting so please help
In perl alarm 15 will send a SIGALRM to itself after 15 seconds. It immediately execs into the check_process_status, so this will be killed!
(While Ctrl-C sends SIGINT.)
The pkill is for terminating the corresponding Network process.
(kill and pkill send SIGTERM by default.)