unable to grep the running processes.

Hi All,

We have a shell script(ODS_Load)which loads the data from perticular flat file to oracle table invoking sqlplus based on the parameter.

When we execute the script(ODS_Load) independently, script is working fine and able to load the tables successfully.

We invoke(ODS_Load) with parameter from another script(Wrapper_ODS_Load), which checks if there are any ODS_Load happening for perticular feed if not then it invokes the ODS_load script. If the ODS_Load is happening then it does not again invoke ODS_Load.

#!/bin/bash
 
CONFLICT=`pgrep -f "ODS_Load $1"`
[ ! "$CONFLICT" ] && ODS_Load $1 &

But the pgrep -f "ODS_Load $1" is not returning any result even though the script ODS_Load is running. Can someone help us debug this issue?

Thanks and Regards
Nagaraja Akkivalli

maybe ODS_Load closes the while assign to CONFLICT val
can u try this.

[ ! `pgrep -f "ODS_Load $1"` ] && ODS_Load $1 &
1 Like