Last active
August 29, 2015 14:04
-
-
Save skatsuta/1de7c0c31824f95a14d4 to your computer and use it in GitHub Desktop.
プロセスの起動確認
This file contains hidden or 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 | |
| PROCESS=$1 | |
| PROCESS_NUM=$(ps cax | grep $PROCESS | wc -l) | |
| # 引数チェック | |
| if [ $# -eq 0 ]; then | |
| echo "Usage: $0 process_name" 1>&2 | |
| exit1 | |
| fi | |
| if [ $PROCESS_NUM -gt 0 ]; then | |
| echo "$PROCESS running." | |
| else | |
| sudo service $PROCESS start | |
| echo "$PROCESS started." | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment