Search Suggest

Bài đăng

Shell script to check process is running or not in Linux

Write a Shell script to check process is running or not in Linux

#!/bin/bash
pid=`pgrep -f apache2`
pid_count=${#pid[@]}

if [  $pid_count -gt "1" ];then
      echo "Apache pid not found"
      exit 1
else
    echo "Starting service"
     service apache2 start
fi

Đăng nhận xét