diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-12-03 13:28:03 -0500 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-12-03 13:28:03 -0500 |
commit | 999b1164a486f5140310207533a69ab3ec1f467e (patch) | |
tree | e3c39b36eb3021f466403c8abfbe9c73176ccaca | |
parent | 50c03668d1d81c93d9c540e6a8c45e604068cc45 (diff) |
daemon: re-think using read
-rw-r--r-- | daemon.sh | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -8,14 +8,13 @@ get_ident() { is_running() { local pidfile=$1 if [[ -f "$pidfile" ]]; then - cat "$pidfile" | while read pid ident1; do - ident2="$(get_ident "$pid")" - if [[ "$ident1" = "$ident2" ]] && [[ -n "$ident2" ]]; then - return 0 - else - return 1 - fi - done + read -r pid ident1 <"$pidfile" + ident2="$(get_ident "$pid")" + if [[ "$ident1" == "$ident2" ]] && [[ -n "$ident2" ]]; then + return 0 + else + return 1 + fi else return 1; fi |