diff options
author | Sergey Matveychuk <sem@FreeBSD.org> | 2004-12-06 20:19:19 +0000 |
---|---|---|
committer | Sergey Matveychuk <sem@FreeBSD.org> | 2004-12-06 20:19:19 +0000 |
commit | 6614218c46fa6a2354226265b5d2ead452cc6000 (patch) | |
tree | c60bf5db72e65dcd6b0f6c4b905fac72a3803ad1 /misc | |
parent | 34b40822efee65acb0dd44d8e2093c2599937967 (diff) | |
download | ports-6614218c46fa6a2354226265b5d2ead452cc6000.tar.gz ports-6614218c46fa6a2354226265b5d2ead452cc6000.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
Notes
Notes:
svn path=/head/; revision=123331
Diffstat (limited to 'misc')
-rw-r--r-- | misc/dnetc/Makefile | 1 | ||||
-rw-r--r-- | misc/dnetc/files/dnetc.sh | 16 |
2 files changed, 13 insertions, 4 deletions
diff --git a/misc/dnetc/Makefile b/misc/dnetc/Makefile index e3ae1874687c..5bcbdf2f6ef8 100644 --- a/misc/dnetc/Makefile +++ b/misc/dnetc/Makefile @@ -7,6 +7,7 @@ PORTNAME= dnetc PORTVERSION= ${VERSION} +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= misc MASTER_SITES= ftp://ftp.distributed.net/pub/dcti/%SUBDIR%/ \ 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 |