summaryrefslogtreecommitdiff
path: root/daemon.sh
diff options
context:
space:
mode:
Diffstat (limited to 'daemon.sh')
-rw-r--r--daemon.sh15
1 files changed, 7 insertions, 8 deletions
diff --git a/daemon.sh b/daemon.sh
index 63def36..3fcbc99 100644
--- a/daemon.sh
+++ b/daemon.sh
@@ -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