my $opt_start_all = 0;
my $opt_stop_all = 0;
my $opt_restart_all = 0;
+my $opt_start_services = 0;
+my $opt_stop_services = 0;
+my $opt_restart_services = 0;
my $opt_force_clean_process = 0;
my $opt_quiet = 0;
my $opt_diagnostic = 0;
'stop-all' => \$opt_stop_all,
'restart' => \$opt_restart,
'restart-all' => \$opt_restart_all,
+ 'start-services' => \$opt_start_services,
+ 'stop-services' => \$opt_stop_services,
+ 'restart-services' => \$opt_restart_services,
'diagnostic' => \$opt_diagnostic
);
return 0;
}
+
sub do_start_all {
- msg("starting all services for $hostname");
+ msg("starting router and services for $hostname");
do_start('router');
+ return do_start_services();
+}
+
+sub do_start_services {
+ msg("starting services for $hostname");
if(grep {$_ eq 'opensrf.settings'} @perl_services) {
do_start('opensrf.settings');
}
}
-sub do_stop_all {
+sub do_stop_services {
my @signals = @_;
+ @signals = qw/TERM INT KILL/ unless @signals;
- msg("stopping all services for $hostname");
-
+ msg("stopping services for $hostname");
my @services = get_service_list_from_files();
- @signals = qw/TERM INT KILL/ unless @signals;
-
+
for my $signal (@signals) {
my @redo;
last unless @services;
}
+ return 1;
+}
+
+sub do_stop_all {
+ my @signals = @_;
+ @signals = qw/TERM INT KILL/ unless @signals;
+
+ do_stop_services(@signals);
+
# graceful shutdown requires the presence of the router, so stop the
# router last. See if it's running first to avoid unnecessary warnings.
do_stop('router', $signals[0]) if get_service_pids_from_file('router');
--start
Start the service specified by --service
+ --start-services
+ Start all services but do not start any routers
+
--restart-all
Restart the router and all services
--restart
Restart the service specified by --service
+ --restart-services
+ Restart all services but do not restart any routers
+
--force-clean-process
When starting a service, if a service process is already running
but no pidfile exists, kill the service process before starting
If the requested service does not have a matching PID file, an
attempt to locate the PID via 'ps' will be made.
+ --stop-services
+ Stop all services but do not stop any routers. See also --stop-all.
+
--graceful-shutdown-all
Send TERM signal to all services + router
do_init() and verify_services($opt_service) if
$opt_start or
$opt_start_all or
+ $opt_start_services or
$opt_restart or
- $opt_restart_all;
+ $opt_restart_all or
+ $opt_restart_services;
# starting services. do_init() handled above
do_start($opt_service) if $opt_start;
do_stop($opt_service) and do_start($opt_service) if $opt_restart;
do_start_all() if $opt_start_all;
+do_start_services() if $opt_start_services;
do_stop_all() and do_start_all() if $opt_restart_all;
+do_stop_services() and do_start_services() if $opt_restart_services;
# stopping services
do_stop($opt_service) if $opt_stop;
do_stop_all() if $opt_stop_all;
+do_stop_services() if $opt_stop_services;
do_stop($opt_service, 'TERM') if $opt_shutdown_graceful;
do_stop($opt_service, 'INT') if $opt_shutdown_fast;
do_stop($opt_service, 'KILL') if $opt_shutdown_immediate;
do_help() if $opt_help or not (
$opt_start or
$opt_start_all or
+ $opt_start_services or
$opt_stop or
$opt_stop_all or
+ $opt_stop_services or
$opt_restart or
$opt_restart_all or
+ $opt_restart_services or
$opt_signal or
$opt_signal_all or
$opt_shutdown_graceful or