Created
November 30, 2015 12:46
-
-
Save koki-h/ec00fe0b683a36262daf to your computer and use it in GitHub Desktop.
2重起動させないための起動スクリプト(pgrepを使う版)
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 | |
| if [ $$ -ne $(pgrep -fo "$0") ]; then | |
| echo "実行中。2重起動を禁止しています。" | |
| exit 1 | |
| fi | |
| trap 'kill $(jobs -p);echo 強制終了されました。' EXIT | |
| #処理本体 | |
| ./hogehoge.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment