initscript_by_name="""#!/bin/bash
command=$1; shift
slicename=$1; shift
-stamp="the_script_name"
-stampfile=/tmp/$stamp.stamp
+stamp="initscript_by_name"
+stampfile=/var/tmp/$stamp.stamp
+date=$(date)
-echo "Running initscript with command=$command and slicename=$slicename"
+echo $date "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
+ (echo $date Starting test initscript: $stamp on slicename $slicename ; date) >> $stampfile
+ echo $date "This is the stdout of the sliver $slicename initscript $command (exp. start) pid=$$"
+ echo $date "This is the stderr of the sliver $slicename initscript $command (exp. start) pid=$$" 1>&2
}
function stop () {
- echo "Removing stamp $stampfile"
+ echo $date "Removing stamp $stampfile"
rm -f $stampfile
}
function restart () {
esac
"""
-initscript_by_code=initscript_by_name.replace("the_script_name","the_script_code")
+initscript_by_code=initscript_by_name.replace("initscript_by_name","initscript_by_code")
# one single initscript in the InitScripts table
def initscripts(options,index):
return [ { 'initscript_fields' : { 'enabled' : True,
- 'name':'the_script_name',
+ 'name':'initscript_by_name',
'script' : initscript_by_name,
}},
]
'sitename' : login_base(index),
'owner' : 'pi',
}
- # 1st one has an initscript_code
+ # 1st one has an initscript by code
if i%3==1:
slice_spec['initscriptcode']=initscript_by_code
- slice_spec['initscriptstamp']='the_script_code'
- # 2nd one has an initscript (name)
+ slice_spec['initscriptstamp']='initscript_by_code'
+ # 2nd one has an initscript by name
elif i%3==2:
- slice_spec['initscriptname']='the_script_name'
- slice_spec['initscriptstamp']='the_script_name'
+ slice_spec['initscriptname']='initscript_by_name'
+ slice_spec['initscriptstamp']='initscript_by_name'
# 3rd one is omf-friendly
else:
+ # potentially turned off with config_no_omf
slice_spec ['omf-friendly'] = True
return slice_spec
# usual index is 1, additional plc's then get 2...