I have also seen this behavior on AIX and a bit on HP-UX. You'll notice the huge amount of debugging code I've added to try and figure out what is going on. Consider adding a loop and checking several times.
I use something like:
Code:
###################################################################################
# Is this job already running
###################################################################################
[[ $VERBOSE -ge $TRUE ]] && print_status_message "STEP: Checking to see if this job is already running..." STEP
RUNNING=$FALSE
LOOP_COUNT=1
MAX_LOOP_COUNT=5
[[ $DEBUG -ge $TRUE ]] && print_status_message "DEBUG: PROGRAM_NAME=$PROGRAM_NAME" DEBUG
[[ $DEBUG -ge $TRUE ]] && print_status_message "DEBUG: STARTDIR=$STARTDIR" DEBUG
[[ $DEBUG -ge $TRUE ]] && print_status_message "\nDEBUG: my PID is: $$" DEBUG
[[ $DEBUG -ge $TRUE ]] && print_status_message "DEBUG: count of running processes..." DEBUG
[[ $DEBUG -ge $TRUE ]] && ps -ef | egrep -v "run_job|timeout|grep|$$" | grep "$PROGRAM_NAME" | grep -c $STARTDIR
sleep 1 # this seems to be necessary
while [[ $(ps -ef | egrep -v "run_job|timeout|grep|$$" | grep "$PROGRAM_NAME" | grep -c $STARTDIR) -gt 0 && $LOOP_COUNT -le $MAX_LOOP_COUNT ]]
do
RUNNING=$TRUE
print_status_message "INFORMATION: it looks like $PROGRAM_NAME is already running against $STARTDIR. Attempt $LOOP_COUNT of $MAX_LOOP_COUNT." INFORAMTION
[[ $DEBUG -ge $TRUE ]] && print_status_message "\nDEBUG: output from ps is:" DEBUG
[[ $DEBUG -ge $TRUE ]] && ps -ef | egrep -v "run_job|timeout|grep|$$" | grep "$PROGRAM_NAME" | grep $STARTDIR
[[ $DEBUG -ge 2 ]] && print_status_message "\nDEBUG: output from ps is:" DEBUG
[[ $DEBUG -ge 2 ]] && ps -ef | egrep -v "run_job|timeout|grep|$$" | grep "$PROGRAM_NAME"
[[ $DEBUG -ge 2 ]] && print_status_message "\nDEBUG: output from ps (ps -ef | egrep -v run_job|timeout|grep|$$) is:" DEBUG
[[ $DEBUG -ge 2 ]] && ps -ef | egrep -v "run_job|timeout|grep|$$"
[[ $DEBUG -ge 3 ]] && print_status_message "\nDEBUG: output from ps is:" DEBUG
[[ $DEBUG -ge 3 ]] && ps -ef | grep "$PROGRAM_NAME"
((LOOP_COUNT += 1))
sleep $(($RANDOM % 21 + 1)) # random number between 1 and 21
done
if [[ $RUNNING -eq $TRUE && $LOOP_COUNT -ge $MAX_LOOP_COUNT ]]
then
print_status_message "\nERROR: giving up after $MAX_LOOP_COUNT tries." ERROR
RETCODE=102
error_exit
fi
Hi folks,
I am using a shell script to display the referred libraries names of any specified cpp code. Given below is the script:
shell script "grblib"
-------------------------------------------------------------------------
#!/bin/sh
# get the lines having "include" pattern
... (5 Replies)
Hi,
I have small script written in korn shell. When it is called from different script, its dumping core, but no core dump when we run it standalone.
And its not dumping core if we run the script using "/bin/sh" instead of "ksh"
Can some body please help me how to resolve this issue.
... (9 Replies)
Hi,
I am trying to start the apache server on 11i for Coverity Prevent using following command:
# cov-start-gui --datadir /qa_home/coverity/data_dir-4.3.0
cov-internal-httpd not running.
For further information, see '/qa_home/coverity/data_dir-4.3.0/logs/error_log'
#
the error_log... (0 Replies)
Please read my issue!
My old server using:
- AIX system operating (5300-05-CSP-0000)
- WebSphere 6.1.0.21 (Fix Pack 21)
After I've upgraded version AIX
- AIX system operating (5300-09-02-0849)
- WebSphere 6.1.0.21 (Fix Pack 21)
I have 1 issue when I access home page:
"Error... (0 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Hi
I'm trying to run a script " abc.sh" which triggers "use.sh" .
abc.sh is nothing but a "expect" script which provides username and password automatically to the use.sh script.
Please find below the scripts:
#abc.sh
#!/usr/bin/expect -f
exec /root/use.sh
expect "*name*"
send... (1 Reply)
Hi, everyone.
I need to write a program to get io info based on libperfstat.
But the "write time" of a disk is just half of the value get from iostat.
I'm confused and can't explain. Help please.
How I calculate "write service time per sec":
In iostat:
write service... (0 Replies)
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
LEARN ABOUT LINUX
zegrep
ZGREP(1) General Commands Manual ZGREP(1)NAME
zgrep - search possibly compressed files for a regular expression
SYNOPSIS
zgrep [ grep_options ] [ -e ] pattern filename...
DESCRIPTION
Zgrep invokes grep on compressed or gzipped files. These grep options will cause zgrep to terminate with an error code:
(-[drRzZ]|--di*|--exc*|--inc*|--rec*|--nu*). All other options specified are passed directly to grep. If no file is specified, then the
standard input is decompressed if necessary and fed to grep. Otherwise the given files are uncompressed if necessary and fed to grep.
If the GREP environment variable is set, zgrep uses it as the grep program to be invoked.
EXIT CODE
2 - An option that is not supported was specified.
AUTHOR
Charles Levert (charles@comm.polymtl.ca)
SEE ALSO grep(1), gzexe(1), gzip(1), zdiff(1), zforce(1), zmore(1), znew(1)ZGREP(1)