Sponsored Content
Top Forums Shell Programming and Scripting While killing the process, Script gets hanged. Please help me on this. Post 302139940 by Sheethal on Wednesday 10th of October 2007 03:13:29 AM
Old 10-10-2007
While killing the process, Script gets hanged. Please help me on this.

Hi Everyone,

I have written a script to automate the docbase cleanup process on every weekly basis. That is in this script i have to shutdown the docbase and then kill all the process that are hanged except one process(epic process) and need to delete some log files and then i have to start the docbase.

The following is the content of the script,

#!/bin/ksh
# docbase cleanup process
DM_DBA=/apps/documentum/dba
cd $DM_DBA

# Next, set up the logfile.
logdir=/apps/documentum/dba/log
if [ ! -d $logdir ] ; then
echo "$0: Fatal error: missing directory $logdir"
exit 1
fi

logfile=/apps/documentum/dba/log/test.log
echo "\n *****Space before cleanup process**** \n" > $logfile
df -k >> $logfile

# process running before shut down
echo "\n *************** Process running before shutdown **************** \n" >> $logfile
ps -ef|grep doc >> $logfile

#shut down Legal
echo "\n ************** shut down Legal ************** \n" >> $logfile
./dm_shutdown_legal >> $logfile
status=$?
if [ ! $status = 0 ] ; then
cat <<-END
***** ERROR DURING LEGAL SHUTDOWN *****
********The legal dmshutdown utility reported a non-zero status **********
END
exit 1
fi

#shut down Docbroker
echo "\n ********** shut down Docbroker *******************\n" >> $logfile
./dm_stop_docbroker
status=$?
if [ ! $status = 0 ] ; then
cat <<-END
***** ERROR DURING DOCBROKER SHUTDOWN *****
********The docbroker shutdown utility reported a non-zero status **********
END
exit 1
fi

#Killing all the process except the Epic process
echo "\n *** Killing process except epic process ******* \n" >> $logfile

ps -ef|grep doc| grep -v '/apps/documentum/epic5.1/bin/sun4r5/adeptlmd -s180 -e /apps/documentum/epic5.1/'|grep -v grep|awk '{print $2}'| xargs kill -9
echo "after killing the process"

#Delete test.out file in buildcd
buildcddir=/apps/documentum/cdrom/apps/buildcd
if [ ! -d $buildcddir ] ; then
echo "\n $0: Fatal error: missing directory $buildcddir \n" >> $logfile
exit 1
fi
buildcdfile= $buildcddir/test.out
if [ -f $buildcdfile ]
then
echo "\n *************** test.out file exist in builcd path ****************\n" >> $logfile
rm $buildcdfile >> $logfile
fi

#starting docbroker
echo " \n ************* starting docbroker ************** \n" >>$logfile
./dm_launch_docbroker >>$logfile
status=$?
if [ ! $status = 0 ] ; then
cat <<-END
***** ERROR DURING DOCBROKER STARTUP *****
********The docbroker start utility reported a non-zero status **********
END
exit 1
fi

#starting legal
echo "\n ************** starting legal *********** \n" >> $logfile
./dm_start_legal >>$logfile
status=$?
if [ ! $status = 0 ] ; then
cat <<-END
***** ERROR DURING LEGAL STARTUP *****
********The legal start utility reported a non-zero status **********
END
exit 1
fi



In the above code, the script gets hanged while executing the statement ps -ef|grep doc| grep -v '/apps/documentum/epic5.1/bin/sun4r5/adeptlmd -s180 -e /apps/documentum/epic5.1/'|grep -v grep|awk '{print $2}'| xargs kill -9

After this statement, the script is not executing any statement.

If i remove this line alone, the script is running without any problem.
But i have to kill all the processes that are hanged after the docbase has been shutdown. and then i have to start the docbase by calling another script which has been already written.


Can anyone please tell me why is my script get hanged at this statement.

Kindly please help me on how to resolve this probelm.

Thanks in advance.

Regards,
Sheethal
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

killing process using a script

can I do ps -ef | grep <process_name> and kill the process is it exists? and send a mail to me that the process was found and killed Thanks much... KS (4 Replies)
Discussion started by: skotapal
4 Replies

2. Shell Programming and Scripting

Killing a process from perl script.

How do I kill a process, say by name "drec" from a perl script. I tried with : ps -eaf | grep drec | awk '{print $2}' | xargs kill -9. The output I got is : ps -eaf | grep drec | awk '{print }' | xargs kill -9 /usr/bin/kill: ipgen: Arguments must be %job or process ids {But, $2 is not... (3 Replies)
Discussion started by: sharuvman
3 Replies

3. AIX

killing a process from a script

Hey all. I'm brand new to this forum and am looking for some help. I have a script that verifies that the backup tapes are working correctly. Basically is uses 1 command: restore -xpqvf > rootvglog I use this for each volume group that we have. We run this everyday but the problem is, we... (4 Replies)
Discussion started by: jalge2
4 Replies

4. Solaris

How to know about a hanged process

Hi, My process is visible in 'ps' command but actually it is not working or it got hanged. This process is not generating any log. Now How can I know that my process got hanged. Please help. (2 Replies)
Discussion started by: sanjay1979
2 Replies

5. Shell Programming and Scripting

script not killing process!

i am using script to connect remotly to server and run some commands , one of these commands is to kill some process but tried different ways with no hope sshpass -p 'pass' ssh -o StrictHostKeyChecking=no server kill -9 `pgrep procs` getting error message "kill: bad argument count" ... (2 Replies)
Discussion started by: mogabr
2 Replies

6. Shell Programming and Scripting

**need help for killing a process through script**

Hello All, i hope you are fine. I need a little help from you people-- inside a script i want to kill a parent process by checking it with the child process.. p_pid=`ps -e | awk '/ra_cmd_d/ {print$1}'` here i am selecting the child process id in p_pid. next-- sleep_pid=`ps -af |... (3 Replies)
Discussion started by: onlyniladri
3 Replies

7. Shell Programming and Scripting

script killing a process from service status output

Hello, can some please suggest a script, for killing the process PID. This are steps I am currently performing to kill the process. I cant user service splunk stop, to kill these processes, because of uid and gid mismatch for splunk user. # service splunk status Splunk status: splunkd... (8 Replies)
Discussion started by: bobby320
8 Replies

8. Shell Programming and Scripting

How to detect Hanged process in shell script?

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

9. Shell Programming and Scripting

Automated Script for Process killing

Hello all, I'm in need of a Script which needs to wait for all the child process to end and then kill the main process. I have a process called mainpp which runs for different instances like evpn, nge, gmn etc so when i query for mainpp process it looks like below. bash-3.2$ ps -eaf |... (6 Replies)
Discussion started by: Mahesh_RPM
6 Replies

10. Shell Programming and Scripting

Killing the process if running for long time in script

I am running a script which will read the data from fail line by line and call the Java program by providing the arguments from the each line. The Java code is working fast for few records and for some records its getting hanged not providing response for morethan one hour. Currently am... (4 Replies)
Discussion started by: dineshaila
4 Replies
All times are GMT -4. The time now is 10:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy