diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 32db104734..2ab05e6a4e 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,7 @@ +2014-05-20 Ramon Novoa + + * bin/pandora_server: Stop the service when the server crashes (win32). + 2014-05-13 Ramon Novoa * bin/pandora_server: Added support to run as a native win32 service. diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server index ed951a1636..3570c965bf 100755 --- a/pandora_server/bin/pandora_server +++ b/pandora_server/bin/pandora_server @@ -148,6 +148,8 @@ sub pandora_crash () { # worried about that. If perl has a more "clean" way to avoid this messages # will be nice to replace this code, but at this time it's the only way I know + callback_stop() if (defined($Config{'__win32_service__'})); + foreach my $error_line (@_) { # Trap the XML error and exit without nasty messages if ($error_line =~ m/XML\/Parser/) { @@ -471,7 +473,7 @@ sub parse_options { } elsif ($service_action eq 'uninstall') { win32_uninstall_service(); } elsif ($service_action eq 'run') { - win32_service_run; + $Config{'__win32_service__'} == 1; } else { error("Unknown action: $service_action"); } @@ -622,8 +624,14 @@ sub main() { } # Parse command line options. -parse_options; +parse_options(); # Run as a regular process. -main(); +if (!defined($Config{'__win32_service__'})) { + main(); +} +# Run as a Windows service. +else { + win32_service_run(); +}