|
23 | 23 | $|=1; # turn off buffering
|
24 | 24 |
|
25 | 25 | my ($quiet, $help, $verbose) = "";
|
26 |
| -my (@start, @stop, @restart, @status) = (); |
| 26 | +my (@start, @stop, @restart, @status, @graceful) = (); |
27 | 27 |
|
28 | 28 | GetOptions(
|
29 | 29 | "help" => \$help,
|
30 | 30 | "start|begin=s{1,4}" => \@start,
|
31 | 31 | "stop|end|shutdown=s{1,4}" => \@stop,
|
32 | 32 | "restart|cycle=s{1,4}" => \@restart,
|
33 | 33 | "status|ping=s{1,4}" => \@status,
|
| 34 | + "graceful|ping=s{1,2}" => \@graceful, |
34 | 35 | "verbose" => \$verbose,
|
35 | 36 | "quiet" => \$quiet,
|
36 | 37 | );
|
37 | 38 |
|
38 |
| -if ($help || !(scalar(@start) || scalar(@stop) || scalar(@restart) || scalar(@status))) { |
| 39 | +if ($help || !(scalar(@start) || scalar(@stop) || scalar(@restart) || scalar(@status) || scalar(@graceful))) { |
39 | 40 | print <<STOP;
|
40 | 41 | Usage: $0 --[action] [service] [service] [service]
|
41 | 42 |
|
|
64 | 65 |
|
65 | 66 | --restart Stops and then starts a service again.
|
66 | 67 |
|
| 68 | + --graceful Does a graceful restart, but only for apache based services |
| 69 | +
|
67 | 70 | --shutdown An alias for --stop.
|
68 | 71 |
|
69 | 72 | --start Puts a service online.
|
|
151 | 154 | }
|
152 | 155 | }
|
153 | 156 |
|
| 157 | +if (scalar(@graceful)) { |
| 158 | + if (grep /^modperl|all|web$/, @status) { |
| 159 | + printSuccess(sub{WRE::Modperl->new(wreConfig=>$config)->graceful}, "Graceful mod_perl"); |
| 160 | + } |
| 161 | + if (grep /^modproxy|all|web$/, @status) { |
| 162 | + printSuccess(sub{WRE::Modproxy->new(wreConfig=>$config)->graceful}, "Graceful mod_proxy"); |
| 163 | + } |
| 164 | +} |
| 165 | + |
154 | 166 | #-------------------------------------------------------------------
|
155 | 167 | sub printSuccess {
|
156 | 168 | my $action = shift;
|
|
0 commit comments