check_process() { # check parameter if [ $1 = "" ]; then return -1 fi # get the running process process_names=$(ps -ef | grep $1 | grep -v grep | awk '{print $8}') for process_name in $process_names do if [ $process_name = $1 ] ; then return 1 fi done # not run and run the process echo "$(date) : process $1 not run, just run it" $1 return 0 }