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

Example of using s.install() #392

Open
buzzlightyear2k opened this issue Apr 23, 2024 · 2 comments
Open

Example of using s.install() #392

buzzlightyear2k opened this issue Apr 23, 2024 · 2 comments

Comments

@buzzlightyear2k
Copy link

Can someone give me an easy example of using s.install() and s.run() to make service visible in Windows Service Manager please

@buzzlightyear2k buzzlightyear2k changed the title Example of using s.install Example of using s.install() Apr 23, 2024
@mitchellwarr
Copy link

You can use the service.Interactive function to tell you if you are in a shell or in a service.
This is if you want to just run the exe to have it auto install itself.

	runningInShell := service.Interactive()
	if runningInShell {
		s.Install()
		return
	}

	err = s.Run()
	if err != nil {
		logger.Error(err)
	}

The other way of doing it is to check for cli flags so you can do my-app.exe install

@mitchellwarr
Copy link

Check out #319 for a much better example though

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

2 participants