#!/bin/bash # Copyright 2015 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. proc start { targetcli restoreconfig iscsid echo "iscsid started" } proc stop { echo "Stopping iscsid" kill $[ cat /var/run/iscsid.pid] targetcli clearconfig confirm=True echo "iscsid stopped" exit 0 } trap stop TERM start while true { sleep 5 } (CommandList children: [ (FuncDef name: start body: (BraceGroup children: [ (C {(targetcli)} {(restoreconfig)}) (C {(iscsid)}) (C {(echo)} {(DQ ("iscsid started"))}) ] spids: [50] ) spids: [44 49] ) (FuncDef name: stop body: (BraceGroup children: [ (C {(echo)} {(DQ ("Stopping iscsid"))}) (C {(kill)} { (CommandSubPart command_list: (CommandList children:[(C {(cat)} {(/var/run/iscsid.pid)})]) left_token: spids: [89 95] ) } ) (C {(targetcli)} {(clearconfig)} {(Lit_VarLike "confirm=") (True)}) (C {(echo)} {(DQ ("iscsid stopped"))}) (C {(exit)} {(0)}) ] spids: [76] ) spids: [70 75] ) (C {(trap)} {(stop)} {(TERM)}) (C {(start)}) (While cond: [(Sentence child:(C {(true)}) terminator:)] body: (DoGroup children:[(C {(sleep)} {(5)})] spids:[136143]) ) ] )