diff options
author | sem <sem@FreeBSD.org> | 2004-12-07 04:19:19 +0800 |
---|---|---|
committer | sem <sem@FreeBSD.org> | 2004-12-07 04:19:19 +0800 |
commit | 812b849cc28e53005ad5b6853b087eb75c4c0f09 (patch) | |
tree | 2c55b310d96f0a953d7007ae40c7a9928839aac5 /misc/dnetc/files | |
parent | ae66485ae38dcb0fef15174885382292d8024c8b (diff) | |
download | freebsd-ports-gnome-812b849cc28e53005ad5b6853b087eb75c4c0f09.tar.gz freebsd-ports-gnome-812b849cc28e53005ad5b6853b087eb75c4c0f09.tar.zst freebsd-ports-gnome-812b849cc28e53005ad5b6853b087eb75c4c0f09.zip |
Improve RC scripts. The previous script didn't check if the process
was already running before attempting to start a new one (or if it
was running before stopping it). This improved version does the
necessary checks.
Pointed out by: Radim Kolar
PR: ports/74512
Submitted by: maintainer
Diffstat (limited to 'misc/dnetc/files')
-rw-r--r-- | misc/dnetc/files/dnetc.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/misc/dnetc/files/dnetc.sh b/misc/dnetc/files/dnetc.sh index 37248bfcdbf2..c7561b1d76c7 100644 --- a/misc/dnetc/files/dnetc.sh +++ b/misc/dnetc/files/dnetc.sh @@ -23,14 +23,22 @@ stop_cmd="${name}_stop" dnetc_start() { - echo -n " dnetc" - su -m ${user} -c "${dir}/dnetc -quiet" 2>/dev/null >/dev/null + if ps -U${user} >/dev/null; then + echo "${name} already running?" + else + su -m ${user} -c "${dir}/${name} -quiet" >/dev/null 2>&1 + echo -n " ${name}" + fi } dnetc_stop() { - su -m ${user} -c "${dir}/dnetc -shutdown" 2>/dev/null >/dev/null - echo -n " dnetc" + if ps -U${user} >/dev/null; then + su -m ${user} -c "${dir}/${name} -shutdown" >/dev/null 2>&1 + echo -n " ${name}" + else + echo "${name} not running?" + fi } load_rc_config $name |