#!/bin/bash
PROCESS="java"
log_found=`ps faux|grep -v grep|grep $PROCESS|grep -v $0|awk '{print $2}'`
if [ "$log_found" == "" ]; then
echo "No process found"
else
echo "Processes found:"
for PID in $log_found; do
echo $PID
done
fi
You must change the PROCESS variable to your process name and add actions for when the process is or isn't found...
No comments:
Post a Comment