Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to use ExitCode? #128

Open
sekmenhuseyin opened this issue Sep 13, 2019 · 0 comments
Open

Question: How to use ExitCode? #128

sekmenhuseyin opened this issue Sep 13, 2019 · 0 comments

Comments

@sekmenhuseyin
Copy link

I want to restart the service if service stopped with an error. I found that you have something called exit code: https://github.com/PeterKottas/DotNetCore.WindowsService/blob/4c0052bef2217c3f6b3ec15a98e23335fc07aa88/Source/PeterKottas.DotNetCore.WindowsService/ExitCode.cs

How can I user it in here:

            ServiceRunner<CMailerService>.Run(config =>
            {                
                config.Service(serviceConfig =>
                {                   
                    serviceConfig.OnStop(service =>
                    {

                       //in here I want to restart the service if exitCode!=0
                        _serviceStoppedMail.SendServiceStoppedMail(ProjectConstants.RestartInfoMail, _lastError);


                        Log.Information("Service {0} is stopping...", name);
                        service.Stop();
                        Log.Information("Service {0} stopped", name);
                    });
                });
            });

@sekmenhuseyin sekmenhuseyin changed the title Question: How to user ExitCode? Question: How to use ExitCode? Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant