From e9308fb70f330613902aeb1a08f4363dea9377f6 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 18 Mar 2011 10:26:16 +0100 Subject: [PATCH 1/1] improved initscript --- system/config_default.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/system/config_default.py b/system/config_default.py index 584a94b..4ef3777 100644 --- a/system/config_default.py +++ b/system/config_default.py @@ -150,25 +150,31 @@ def keys (options,index): ############################## initscripts initscript_by_name="""#! /bin/sh -builtin="the_script_name" -stamp=/tmp/$builtin.stamp command=$1; shift slicename=$1; shift -case $command in -start) - (echo Starting test initscript: $builtin on slicename $slicename ; date) >> $stamp +stamp="the_script_name" +stampfile=/tmp/$stamp.stamp + +echo "Running initscript with command=$command and slicename=$slicename" + +function start () { + (echo Starting test initscript: $stamp on slicename $slicename ; date) >> $stampfile echo "This is the stdout of the sliver $slicename initscript $command (exp. start) pid=$$" echo "This is the stderr of the sliver $slicename initscript $command (exp. start) pid=$$" 1>&2 -;; -stop) - rm $stamp -;; -restart) - echo "Dummy restart" -;; -*) - echo "Unknown command in initscript $command" -;; +} +function stop () { + echo "Removing stamp $stampfile" + rm -f $stampfile +} +function restart () { + stop + start +} +case $command in +start) start ;; +stop) stop ;; +restart) restart ;; +*) echo "Unknown command in initscript $command" ;; esac """ -- 2.43.0