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

How to set Start Parameter in windows service #75

Closed
vigneshr6 opened this issue Oct 18, 2016 · 8 comments
Closed

How to set Start Parameter in windows service #75

vigneshr6 opened this issue Oct 18, 2016 · 8 comments

Comments

@vigneshr6
Copy link

My Application have to get http port to run.
I have to set the port number in windows start parameter

@kardianos
Copy link
Owner

Use configuration file or pass args on install.

On Tue, Oct 18, 2016, 03:51 Vigneshr6 [email protected] wrote:

My Application have to get http port to run.
I have to set the port number in windows start parameter


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#75, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAuFsQLKw3fXB7i5ecqhK2LevEyHSJ6Yks5q1KS_gaJpZM4KZpPD
.

@vigneshr6
Copy link
Author

The link you gave is not valid for my account.

Can u give me the Sample code?

@vigneshr6
Copy link
Author

vigneshr6 commented Oct 20, 2016

I used your logging program to run my go application as a service in windows.
But It did not work in linux.
Do you have any sample program for linux?

@astax-t
Copy link

astax-t commented Oct 20, 2016

Github issues is not really a place to ask for help with writing your code. They are to report problems with the product.

You might be better go and check stackoverflow.com or ask the question there.

@2opremio
Copy link

Use configuration file or pass args on install.

Or the library could pass the start arguments instead of ignoring them: #82 :)

Github issues is not really a place to ask for help with writing your code. They are to report problems with the product.

I think it is the right place when the confusion is partly caused by a missing feature.

@kardianos
Copy link
Owner

To configure service to run an executable with a given set of arguments, set https://godoc.org/github.com/kardianos/service#Config.Arguments to the arguments before install. Then when it is started the windows service manager will pass those arguments to the executable. To access them at runtime you should use https://golang.org/pkg/os/#Args .

Please let me know if this answers your questions.

@vigneshr6
Copy link
Author

vigneshr6 commented Feb 20, 2017

Yes This is what I asked for
thanks @kardianos

@marinator86
Copy link

@kardianos thanks for the answer. When given arguments in the config, the service starts and those args get passed to the service. What do I need to do now if I need to control a running service? Do I need to create another service instance via Service.new(), passing in the same config with the arguments given on start? Or does it just need the name of the Service?

Thanks a lot for your help!
Mario

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

5 participants