Hey there,
I need to check the running processes for a stuck archive process that sometimes gets hung up on a log file. Here is what I have:
while read processes
do
echo "Checking $processes for hung file"
ps -ef | grep "$processes" > gzipcheck.dat
status2=`fgrep -v "grep" gzipcheck.dat`
if [ -n "$status2" ]
then
echo "$status2"
else
echo "not hung"
fi
done < processes.dat
It works fine but it returns processes it should. Example: one of the log files I search for is simply 'ms.ddmmyy_hhmmss.log' what I would like to do is have the ps -ef | grep "$processes" > gzipcheck.dat line check for processes that have a .log in the name... but I can't figure out how to get the grep command to search for something like "$processes" ending with a .log.
Any ideas?
I need to check the running processes for a stuck archive process that sometimes gets hung up on a log file. Here is what I have:
while read processes
do
echo "Checking $processes for hung file"
ps -ef | grep "$processes" > gzipcheck.dat
status2=`fgrep -v "grep" gzipcheck.dat`
if [ -n "$status2" ]
then
echo "$status2"
else
echo "not hung"
fi
done < processes.dat
It works fine but it returns processes it should. Example: one of the log files I search for is simply 'ms.ddmmyy_hhmmss.log' what I would like to do is have the ps -ef | grep "$processes" > gzipcheck.dat line check for processes that have a .log in the name... but I can't figure out how to get the grep command to search for something like "$processes" ending with a .log.
Any ideas?