(command.CommandList children: [ (command.ShFunction name: usage body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (C {<echo>} { (DQ <'Usage: '> ($ Id.VSub_Number 0) <' [ -y ] [ -g<grace> ] [ -i<initstate> ] [ message ]'> ) } ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: notify body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple words: [{<'/usr/sbin/wall'>} {<-a>}] redirects: [ (redir op: <Id.Redir_DLessDash '<<-'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<Id.KW_Bang '!'>} here_end_span_id: 149 stdin_parts: [($ Id.VSub_Star '*') <'\n'>] ) ) ] more_env: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'nologin='> name:nologin) op: assign_op.Equal rhs: {<'/etc/nologin'>} spids: [165] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'PATH='> name:PATH) op: assign_op.Equal rhs: {<'/usr/sbin'> <Id.Lit_Colon ':'> <'/usr/bin'> <Id.Lit_Colon ':'> <'/sbin'>} spids: [176] ) ] redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-d>} {<'/usr/bin'>} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (C {<echo>} { (DQ ($ Id.VSub_Number 0) <': /usr is not mounted. Mount /usr or use init to shutdown.'> ) } ) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<1>}) ] spids: [194 206] ) ] else_action: [] redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [(C {<Id.Lit_LBracket '['>} {<-x>} {<'/usr/bin/id'>} {<Id.Lit_RBracket ']'>})] ) action: [ (C {<eval>} { (command_sub left_token: <Id.Left_Backtick '`'> child: (command.Pipeline children: [(C {<'/usr/bin/id'>}) (C {<'/usr/bin/sed'>} {(SQ <'s/[^a-z0-9=].*//'>)})] negated: F stderr_indices: [] ) right: <Id.Backtick_Right '`'> ) } ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} { (DQ (braced_var_sub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Name uid> var_name: uid suffix_op: (suffix_op.Unary op:<Id.VTest_ColonEquals _> arg_word:{<0>}) right: <Id.Right_DollarBrace '}'> ) ) } {<-ne>} {<0>} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (C {<echo>} {(DQ ($ Id.VSub_Number 0) <': Only root can run '> ($ Id.VSub_Number 0))} ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<2>} ) ] spids: [254 273] ) ] else_action: [] redirects: [] ) ] spids: [224 234] ) ] else_action: [ (C {<echo>} {(DQ ($ Id.VSub_Number 0) <': can\'t check user id.'>)}) (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<2>}) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'grace='> name:grace) op: assign_op.Equal rhs: {<60>} spids: [314] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'askconfirmation='> name:askconfirmation) op: assign_op.Equal rhs: {<yes>} spids: [317] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'initstate='> name:initstate) op: assign_op.Equal rhs: {<s>} spids: [320] ) ] redirects: [] ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (C {<getopts>} {<g> <Id.Lit_Colon ':'> <i> <Id.Lit_Colon ':'> <y> <Id.Lit_QMark '?'>} {<c>}) ] ) body: (command.DoGroup children: [ (command.Case to_match: {($ Id.VSub_DollarName c)} arms: [ (case_arm pat_list: [{<g>}] action: [ (command.Case to_match: {($ Id.VSub_DollarName OPTARG)} arms: [ (case_arm pat_list: [ {<Id.Lit_Star '*'> <Id.Lit_LBracket '['> <Id.KW_Bang '!'> <0-9> <Id.Lit_RBracket ']'> <Id.Lit_Star '*'> } ] action: [ (C {<echo>} {(DQ ($ Id.VSub_Number 0) <': -g requires a numeric option'>)}) (C {<usage>}) ] spids: [358 365 379 -1] ) (case_arm pat_list: [ {<Id.Lit_LBracket '['> <0-9> <Id.Lit_RBracket ']'> <Id.Lit_Star '*'>} ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'grace='> name:grace) op: assign_op.Equal rhs: {($ Id.VSub_DollarName OPTARG)} spids: [390] ) ] redirects: [] ) ] spids: [382 387 394 -1] ) ] redirects: [] ) ] spids: [347 348 400 -1] ) (case_arm pat_list: [{<i>}] action: [ (command.Case to_match: {($ Id.VSub_DollarName OPTARG)} arms: [ (case_arm pat_list: [{<Id.Lit_LBracket '['> <Ss0156> <Id.Lit_RBracket ']'>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left: <Id.Lit_VarLike 'initstate='> name: initstate ) op: assign_op.Equal rhs: {($ Id.VSub_DollarName OPTARG)} spids: [420] ) ] redirects: [] ) ] spids: [414 417 424 -1] ) (case_arm pat_list: [{<Id.Lit_LBracket '['> <234abcqQ> <Id.Lit_RBracket ']'>}] action: [ (C {<echo>} { (DQ ($ Id.VSub_Number 0) <': Initstate '> ($ Id.VSub_DollarName OPTARG) <' is not for system shutdown'> ) } ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [427 430 448 -1] ) (case_arm pat_list: [{<Id.Lit_Star '*'>}] action: [ (C {<echo>} { (DQ ($ Id.VSub_Number 0) <': '> ($ Id.VSub_DollarName OPTARG) <' is not a valid initstate'> ) } ) (C {<usage>}) ] spids: [451 452 468 -1] ) ] redirects: [] ) ] spids: [403 404 474 -1] ) (case_arm pat_list: [{<y>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left: <Id.Lit_VarLike 'askconfirmation='> name: askconfirmation ) op: assign_op.Equal rhs: (rhs_word.Empty) spids: [481] ) ] redirects: [] ) ] spids: [477 478 484 -1] ) (case_arm pat_list: [{(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\?'> ch:'?')}] action: [(C {<usage>})] spids: [487 488 493 -1] ) ] redirects: [] ) ] ) redirects: [] ) (C {<shift>} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Minus left: {($ Id.VSub_DollarName OPTIND)} right: {<Id.Lit_Digits 1>} ) ) } ) (C {<echo>} {(SQ <'\\nShutdown started. \\c'>)}) (C {<'/usr/bin/date'>}) (C {<echo>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'NODENAME='> name:NODENAME) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_Backtick '`'> child: (C {<uname>} {<-n>}) right: <Id.Backtick_Right '`'> ) } spids: [523] ) ] redirects: [] ) (C {<cd>} {<'/'>}) (C {<trap>} {(DQ <'rm '> ($ Id.VSub_DollarName nologin) <' >/dev/null 2>&1 ;exit 1'>)} {<1>} {<2>} {<15>} ) (command.ForEach iter_names: [i] iterable: (for_iter.Words words: [{<7200>} {<3600>} {<1800>} {<1200>} {<600>} {<300>} {<120>} {<60>} {<30>} {<10>}] ) body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name grace)} {<-gt>} {($ Id.VSub_DollarName i)} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'hours='> name:hours) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Slash left: {(${ Id.VSub_Name grace)} right: {<Id.Lit_Digits 3600>} ) ) } spids: [605] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'minutes='> name:minutes) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Slash left: (arith_expr.Binary op_id: Id.Arith_Percent left: {(${ Id.VSub_Name grace)} right: {<Id.Lit_Digits 3600>} ) right: {<Id.Lit_Digits 60>} ) ) } spids: [618] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'seconds='> name:seconds) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Percent left: {(${ Id.VSub_Name grace)} right: {<Id.Lit_Digits 60>} ) ) } spids: [635] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'time='> name:time) op: assign_op.Equal rhs: {(DQ )} spids: [648] ) ] redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name hours)} {<-gt>} {<1>} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'time='> name:time) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name hours) <' hours '>)} spids: [671] ) ] redirects: [] ) ] spids: [653 668] ) (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name hours)} {<-eq>} {<1>} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'time='> name:time) op: assign_op.Equal rhs: {(DQ <'1 hour '>)} spids: [698] ) ] redirects: [] ) ] spids: [680 695] ) ] else_action: [] redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name minutes)} {<-gt>} {<1>} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'time='> name:time) op: assign_op.Equal rhs: { (DQ (${ Id.VSub_Name time) (${ Id.VSub_Name minutes) <' minutes '> ) } spids: [725] ) ] redirects: [] ) ] spids: [707 722] ) (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name minutes)} {<-eq>} {<1>} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'time='> name:time) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name time) <'1 minute '>)} spids: [755] ) ] redirects: [] ) ] spids: [737 752] ) ] else_action: [] redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name hours)} {<-eq>} {<0>} {<-a>} {(${ Id.VSub_Name seconds)} {<-gt>} {<0>} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name seconds)} {<-eq>} {<1>} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left: <Id.Lit_VarLike 'time='> name: time ) op: assign_op.Equal rhs: { (DQ (${ Id.VSub_Name time) (${ Id.VSub_Name seconds) <' second'> ) } spids: [813] ) ] redirects: [] ) ] spids: [795 810] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'time='> name:time) op: assign_op.Equal rhs: { (DQ (${ Id.VSub_Name time) (${ Id.VSub_Name seconds) <' seconds'> ) } spids: [828] ) ] redirects: [] ) ] redirects: [] ) ] spids: [767 792] ) ] else_action: [] redirects: [] ) (command.Subshell child: (C {<notify>} { (DQ <'The system '> (${ Id.VSub_Name NODENAME) <' will be shut down in '> (${ Id.VSub_Name time) <'\n'> ($ Id.VSub_Star '*') ) } ) redirects: [] ) (command.Simple words: [{<rm>} {($ Id.VSub_DollarName nologin)}] 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>} ) ] more_env: [] do_fork: T ) (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {($ Id.VSub_DollarName nologin)} ) (redir op: <Id.Redir_DLessDash '<<-'> loc: (redir_loc.Fd fd:0) arg: (redir_param.HereDoc here_begin: {<Id.KW_Bang '!'>} here_end_span_id: 897 stdin_parts: [ <'\n'> <'NO LOGINS: System going down in '> (${ Id.VSub_Name time) <'\n'> ($ Id.VSub_Star '*') <'\n'> <'\n'> ] ) ) ] more_env: [] do_fork: T ) (C {<'/usr/bin/sleep'>} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Minus left: {(${ Id.VSub_Name grace)} right: {($ Id.VSub_DollarName i)} ) ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'grace='> name:grace) op: assign_op.Equal rhs: {($ Id.VSub_DollarName i)} spids: [914] ) ] redirects: [] ) ] spids: [587 602] ) ] else_action: [] redirects: [] ) ] ) redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name askconfirmation)} {<Id.Lit_RBracket ']'>}) ] ) action: [ (C {<echo>} {(DQ <'Do you want to continue? (y or n): '> <Id.Lit_BadBackslash '\\'> <c>)}) (C {<read>} {<b>}) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName b))} {<Id.KW_Bang '!'> <Id.Lit_Equals '='>} {(DQ <y>)} {<Id.Lit_RBracket ']'>} ) ] ) action: [ (C {<notify>} { (DQ <'False Alarm: The system '> (${ Id.VSub_Name NODENAME) <' will not be brought down.'> ) } ) (C {<echo>} {(SQ <'Shutdown aborted.'>)}) (command.Simple words: [{<rm>} {($ Id.VSub_DollarName nologin)}] 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>} ) ] more_env: [] do_fork: T ) (command.ControlFlow token: <Id.ControlFlow_Exit exit> arg_word: {<1>} ) ] spids: [954 972] ) ] else_action: [] redirects: [] ) ] spids: [927 937] ) ] else_action: [] redirects: [] ) (command.Subshell child: (C {<notify>} { (DQ <'THE SYSTEM '> (${ Id.VSub_Name NODENAME) <' IS BEING SHUT DOWN NOW ! ! !\n'> <'Log off now or risk your files being damaged\n'> ($ Id.VSub_Star '*') ) } ) redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name grace)} {<-gt>} {<0>} {<Id.Lit_RBracket ']'>}) ] ) action: [(C {<'/usr/bin/sleep'>} {(${ Id.VSub_Name grace)})] spids: [1034 1048] ) ] else_action: [] redirects: [] ) (C {<echo>} {(DQ <'Changing to init state '> ($ Id.VSub_DollarName initstate) <' - please wait'>)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'i='> name:i) op: assign_op.Equal rhs: {<0>} spids: [1084] ) ] redirects: [] ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-e>} {<'/etc/svc/volatile/repository_door'>} {<-a>} {($ Id.VSub_DollarName i)} {<-lt>} {<3>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) body: (command.DoGroup children: [ (C {<sleep>} {<1>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'i='> name:i) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: {($ Id.VSub_DollarName i)} right: {<Id.Lit_Digits 1>} ) ) } spids: [1119] ) ] redirects: [] ) ] ) redirects: [] ) (command.If arms: [ (if_arm cond: (condition.Shell commands: [ (command.Sentence child: (C {<Id.Lit_LBracket '['>} {<Id.KW_Bang '!'>} {<-e>} {<'/etc/svc/volatile/repository_door'>} {<Id.Lit_RBracket ']'>} ) terminator: <Id.Op_Semi _> ) ] ) action: [(C {<notify>} {(DQ <'Could not find repository door, init-state change may fail!'>)})] spids: [1132 1145] ) ] else_action: [] redirects: [] ) (C {<'/sbin/init'>} {(${ Id.VSub_Name initstate)}) ] )