(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pidfile) op: assign_op.Equal rhs: {(DQ <'/var/run/validation-reporter.pid'>)} spids: [27] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:logfile) op: assign_op.Equal rhs: {(DQ <'/var/log/unbound.log'>)} spids: [36] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:notify_cmd) op: assign_op.Equal rhs: {(DQ <'nc localhost 1234'>)} spids: [57] ) ] ) (command.ShFunction name: reporter_daemon body: (BraceGroup children: [ (C {<trap>} { (DQ <'rm -f '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ($ Id.VSub_DollarName '$pidfile') (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) ) } {<EXIT>} ) (command.Pipeline children: [ (C {<tail>} {<-F>} {($ Id.VSub_DollarName '$logfile')}) (C {<grep>} {<--line-buffered>} {(DQ <'unbound.*info: validation failure'>)}) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [(command.Sentence child:(C {<read>} {<x>}) terminator:<Id.Op_Semi _>)] ) body: (command.DoGroup children: [ (command.Pipeline children: [ (C {<echo>} {(DQ ($ Id.VSub_DollarName '$x'))}) (C {($ Id.VSub_DollarName '$notify_cmd')}) ] negated: F ) ] ) ) ] negated: F ) ] ) ) (command.ShFunction name: start_daemon body: (BraceGroup children: [ (C {<echo>} {(DQ <'starting reporter'>)}) (command.Sentence child: (command.Simple words: [{<nohup>} {($ Id.VSub_Number '$0')} {<rundaemon>}] redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {<'/dev/null'>} ) (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) (redir op: <Id.Redir_GreatAnd '2>&'> loc: (redir_loc.Fd fd:2) arg: {<1>} ) ] do_fork: T ) terminator: <Id.Op_Amp _> ) (command.Simple words: [{<echo>} {($ Id.VSub_Bang '$!')}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_DollarName '$pidfile'))} ) ] do_fork: T ) ] ) ) (command.ShFunction name: kill_daemon body: (BraceGroup children: [ (C {<echo>} {(DQ <'stopping reporter'>)}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<-s>} {(DQ ($ Id.VSub_DollarName '$pidfile'))}) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<kill>} { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<cat>} {(DQ ($ Id.VSub_DollarName '$pidfile'))}) ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple words: [ {<kill>} {<-0>} { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<cat>} {(DQ ($ Id.VSub_DollarName '$pidfile'))}) ) } ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) (redir op: <Id.Redir_GreatAnd '2>&'> loc: (redir_loc.Fd fd:2) arg: {<1>} ) ] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<sleep>} {<1>}) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (command.Simple words: [ {<kill>} {<-0>} { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<cat>} {(DQ ($ Id.VSub_DollarName '$pidfile'))}) ) } ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) (redir op: <Id.Redir_GreatAnd '2>&'> loc: (redir_loc.Fd fd:2) arg: {<1>} ) ] do_fork: T ) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup children: [ (command.Simple words: [ {<kill>} { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<cat>} {(DQ ($ Id.VSub_DollarName '$pidfile'))}) ) } ] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) (redir op: <Id.Redir_GreatAnd '2>&'> loc: (redir_loc.Fd fd:2) arg: {<1>} ) ] do_fork: T ) (C {<echo>} {(DQ <'waiting for reporter to stop'>)}) (C {<sleep>} {<1>}) ] ) ) ] spids: [235 258] ) ] ) ] spids: [204 215] ) ] ) ] ) ) (command.ShFunction name: get_status_daemon body: (BraceGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<test>} {<-s>} {(DQ ($ Id.VSub_DollarName '$pidfile'))}) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<kill>} {<-0>} { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<cat>} {(DQ ($ Id.VSub_DollarName '$pidfile'))}) ) } ) terminator: <Id.Op_Semi _> ) ] ) action: [ (command.Sentence child: (command.ControlFlow token: <Id.ControlFlow_Return return> arg_word: {<0>} ) terminator: <Id.Op_Semi _> ) ] spids: [355 372] ) ] ) ] spids: [341 352] ) ] ) (command.Sentence child: (command.ControlFlow token:<Id.ControlFlow_Return return> arg_word:{<1>}) terminator: <Id.Op_Semi _> ) ] ) ) (command.ShFunction name: restart_daemon body: (BraceGroup children:[(C {<kill_daemon>}) (C {<start_daemon>})]) ) (command.ShFunction name: condrestart_daemon body: (BraceGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<get_status_daemon>}) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<echo>} {(DQ <'reporter ('>) (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<cat>} {(DQ ($ Id.VSub_DollarName '$pidfile'))}) ) (DQ <') is running'>) } ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) ] spids: [417 422] ) ] ) (C {<start_daemon>}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>}) ] ) ) (command.ShFunction name: status_daemon body: (BraceGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<get_status_daemon>}) terminator: <Id.Op_Semi _> ) ] ) action: [ (C {<echo>} {(DQ <'reporter ('>) (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<cat>} {(DQ ($ Id.VSub_DollarName '$pidfile'))}) ) (DQ <') is running'>) } ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<0>} ) ] spids: [469 474] ) ] ) (C {<echo>} {(DQ <'reporter is not running'>)}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] ) ) (command.Case to_match: {(DQ ($ Id.VSub_Number '$1'))} arms: [ (case_arm pat_list: [{<rundaemon>}] action: [(C {<reporter_daemon>})] spids: [527 528 534 -1] ) (case_arm pat_list:[{<start>}] action:[(C {<start_daemon>})] spids:[537 538 544 -1]) (case_arm pat_list:[{<stop>}] action:[(C {<kill_daemon>})] spids:[547 548 554 -1]) (case_arm pat_list: [{<restart>}] action: [(C {<restart_daemon>})] spids: [557 558 564 -1] ) (case_arm pat_list: [{<condrestart>}] action: [(C {<condrestart_daemon>})] spids: [567 568 574 -1] ) (case_arm pat_list: [{<status>}] action: [(C {<status_daemon>})] spids: [577 578 584 -1] ) (case_arm pat_list: [{<Id.Lit_Star '*'>}] action: [ (C {<echo>} {(DQ <'Usage: '> ($ Id.VSub_Number '$0') <' {start|stop|restart|condrestart|status}'>)} ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<2>}) ] spids: [587 588 605 -1] ) ] ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{($ Id.VSub_QMark '$?')}) ] )