Last active
August 9, 2017 22:46
-
-
Save peco8/8de090a51a547a741b596bf622bf639e to your computer and use it in GitHub Desktop.
ps_check.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
#!/bin/bash | |
ps_out=`ps -ef | grep $1 | grep -v 'grep' | grep -v $0` | |
result=$(echo $ps_out | grep "$1") | |
if [[ "$result" != "" ]];then | |
echo "Running" | |
else | |
echo "Not Running" | |
fi | |
``` | |
``` | |
20:10 $ checkRunningProcess.sh proxy.py | |
Running | |
20:12 $ checkRunningProcess.sh abcdef | |
Not Running | |
``` | |
########################### | |
``` | |
!/bin/bash | |
CHECK=$0 | |
SERVICE=$1 | |
DATE=`date` | |
OUTPUT=$(ps aux | grep -v grep | grep -v $CHECK |grep $1) | |
echo $OUTPUT | |
if [ "${#OUTPUT}" -gt 0 ] ; | |
then echo "$DATE: $SERVICE service running, everything is fine" | |
else echo "$DATE: $SERVICE is not running" | |
fi | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yum -y remove httpd
http://uxmilk.jp/9134
https://superuser.com/questions/547280/how-to-completely-uninstall-a-package-including-all-extra-files-that-came-with