takama / daemon

A daemon package for use with Go (golang) services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example

wahmedswl opened this issue · comments

Hi,
Could you plz provide simple example where actual logic should be implemented. In the example given, if its been called with arguments eg

myservice install

will the later portion be called? It would be great if simple example would be provided that would allow all actions like install/start/stop etc just like in the provided example but simplified.

Thanks

Extending example at README:

....
	switch command {
	case "install":
		deleted := 0
		for i := range args {
		    j := i - deleted
		    if args[j] == "install" {
			args = args[:j+copy(args[j:], args[j+1:])]
			deleted++
		    }
		}
		return service.Install(args...)
....

And install service with:

myservice install -config x.ini

where config is read by your service with flag.String("config", "x.ini","Config file").

yes can we add this to readme? It is not clear how install/start etc. all work when the only example is using an eventloop. I am trying to use this for a cron job and would be nice to have some more examples