Reference: http://giantdorks.org/alain/make-a-bash-script-quit-if-it-detects-multiple-running-instances-of-itself/
#!/bin/bash if [ "$(pgrep -x $(basename $0))" != "$$" ]; then echo "Error: another instance of $(basename $0) is already running" exit 1 fi
沒有留言:
張貼留言