add a bit more boiler plate code. Right now I just touch a file in $STATEDIR,
maybe this should include the path to the Nix store and a sanity check should be added to make sure that if we check the file in $STATEDIR that it is indeed from an instance of the service that we want to start. This adds complexity, because how should we deal with the situation of they are not equal. TODO: add a "status" command, or a "version" command, which displays which service is currently registered with the system as "running" svn path=/nixpkgs/trunk/; revision=5015
This commit is contained in:
parent
9a198b5192
commit
742c1ef85e
@ -18,21 +18,36 @@ start_deps() {
|
||||
exit $RETVAL
|
||||
}
|
||||
|
||||
start_softdeps() {
|
||||
for i in $softdeps
|
||||
$i start
|
||||
RETVAL=$?
|
||||
if test $RETVAL != 0; then
|
||||
continue
|
||||
}
|
||||
|
||||
start() {
|
||||
# aren't we already running?
|
||||
# @gnugrep@/bin/grep $prog
|
||||
# are we already running?
|
||||
# if so, exit with code 0
|
||||
if test -a $STATDIR/$prog = 1; then
|
||||
exit 0
|
||||
# if not, continue
|
||||
# launch all hard dependencies
|
||||
start_deps
|
||||
# launch all preferred dependencies
|
||||
start_softdeps
|
||||
# launch our own program
|
||||
}
|
||||
|
||||
stop() {
|
||||
# are we running? If so, then stop, otherwise, do nothing...
|
||||
if test -a $STATDIR/program = 0; then
|
||||
echo "bla"
|
||||
if test -a $STATDIR/$prog = 0; then
|
||||
exit 0
|
||||
# stop our own program
|
||||
}
|
||||
|
||||
register() {
|
||||
touch $STATEDIR/$prog
|
||||
}
|
||||
|
||||
unregister() {
|
||||
|
Loading…
Reference in New Issue
Block a user