Coder Social home page Coder Social logo

daemon's Introduction

daemon's People

Contributors

acamilleri avatar algorathdev avatar demired avatar derkan avatar donnpebe avatar ehalpern avatar fatihky avatar itskingori avatar jannickfahlbusch avatar loint avatar maximus12793 avatar maxxant avatar neverland4u avatar nus avatar pichuchen avatar rusq avatar sheile avatar sidepelican avatar takama avatar tobyzxj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

daemon's Issues

service can not start

I follow the following steps to do, but can not start:
go build myservice.go
./myservice install
Install My Echo Service: [ OK ]
./myservice start
Starting My Echo Service: [FAILED]
Error: exit status 5

system is ubuntu.16.04

Can I increase the "max file open"

I increase the system max file open in LINUX success,but my process always 1024
#cat /proc/4918/limits
Limit Soft Limit Hard Limit Units
...
Max open files 1024 1024 files
...

#ulimit -n
655350

service removing problem under OSX

Hi, i'm working on OSX 10.13.3

Service is not unload when you remove it on OSX.
You can remove service and trying to install it, you will get: "service is already running" because function Remove() doesn't unload service before removing the plist file.

Some solution possible:
1 - Add in my code Stop() before call Remove() (very bad solution)
2- In function Remove() add this code to check if service is running and stop it before remove it:

if _, ok := darwin.checkRunning(); ok {
	stopAction, err := darwin.Stop()
	if err != nil {
		return stopAction, err
	}
}

Typo

helper.go
line 27

"Service is alredy running"

Modeling the flow of the daemon

Great package, thank you.

I was wondering about the flow of the daemonization, hoping to see if my thought process is accurate.

Going off of: https://github.com/takama/daemon/blob/master/examples/cron/cron_job.go#L50

Is the idea then that:

  1. call service.Install only once needed
  2. call service.Start, this causes the usual daemonization double fork which creates its own instance but this time calling itself without a flag and hence going into the Cron working ?

Not entirely clear about 2 because I'm using cobra as a wrapper, so will that work nicely with the command line flags, arguments used by the double fork? Or should I expliclty control the commands used?

Example, I want to have it be: h-watchdog service start where I'm grouping all the daemon related commands under service subcommand.

Example does not work

Hi!

I tried to run your example on windows - removed the dummy.service dependency and tried to install/run the example service. It seems it does not respond to control requests and thus it fails to start:

C:\Users\admin\go\x>x install
Install My Echo Service: completed.

C:\Users\admin\go\x>x status
Status: SERVICE_STOPPED

C:\Users\admin\go\x>x start
Starting My Echo Service:                                       [�[31mFAILED�[0m]
Error:  The service did not respond to the start or control request in a timely fashion.

C:\Users\admin\go\x>

Remove service

When a remove command is issued on a running service, should the service not be stopped first?
On OSX/darwin (and possibly other systems) this is not the case

Windows Service Cannot Start (ERROR_SERVICE_REQUEST_TIMEOUT)

Problem

Attempting to start windows service results in a long pause and the following error returned:

ERROR_SERVICE_REQUEST_TIMEOUT: The service did not respond to the start or control request in a timely fashion.

I believe this problem is caused by the fact that that the service control manager is expecting a "status" to be returned from the underlying executable it's managing:

The SCM starts the process and waits until either the child process exits (indicating a failure) or reports the SERVICE_RUNNING status.

source: https://msdn.microsoft.com/en-us/library/windows/desktop/ms685990(v=vs.85).aspx

Solution

If sc.exe is desired to be used over nssm.exe then I believe a more complex solution is required. Specifically a "SERVICE_RUNNING" status will need to be returned back to the windows service control manager.

Take a look at the following that appears to effectively perform this action:
https://github.com/kardianos/service/blob/0ab6efe2ea51f0531a8ceaaa33416b3aab844c28/service_windows.go#L167

PID file not found

Hi,

I am using this package for a service running on ubuntu

When I look at the service file I see that the pid file should be in /var/run

But the service starts and stops just fine and no pid file is ever generated there.
I searched the whole disk, but no pid file

Where is it?

check service installed

Hi,

Is it possible to change isInstalled private function in public function ?
It's maybe interesting to have public function for check if service is already installed.

What do you think ?

daemon service does not work in Ubuntu

Hi Igor,

Now it works great in CentOS, but when I change the environment to Ubuntu, it does not work anymore. The service script in "daemon_linux_systemv.go" may be not suitable with ubuntu service pattern. Do you have any idea for this case ?

no idea how to persist items in dameon process

    package main

    import (
        "fmt"
        "github.com/robfig/cron"
        "github.com/takama/daemon"
        "log"
        "os"
    )

    const (
        // name of the service
        name        = "cronTool"
        description = "Cron service task"
    )

    var stdlog, errlog *log.Logger

    // Service is the daemon service struct
    type Service struct {
        d daemon.Daemon
        c cron.Cron
    }

    func startCron(c *cron.Cron) {
        // Run 1x everymin
        c.AddFunc("* * * * * *", func() { makeFile() })
        c.Start()
    }
    func stopCron(c *cron.Cron) {
        c.Stop()
    }

    var times int

    func makeFile() {
        times++
        f, err := os.Create(fmt.Sprintf("%d.txt", times))
        if err != nil {
            log.Fatal(err)
        }
        defer f.Close()
    }

    // Manage by daemon commands or run the daemon
    func (service *Service) Manage() (string, error) {

        usage := "Usage: cronStock install | remove | start | stop | status"
        // if received any kind of command, do it
        if len(os.Args) > 1 {
            command := os.Args[1]
            switch command {
            case "install":
                startCron(&service.c)
                return service.d.Install()
            case "remove":
                return service.d.Remove()
            case "start":
                startCron(&service.c)
                return service.d.Start()
            case "stop":
                stopCron(&service.c)
                return service.d.Stop()
            case "status":
                return service.d.Status()
            default:
                return usage, nil
            }
        }

        // // c.AddFunc("@weekly", func() {}) // my actual usage will be as follows
        return usage, nil
    }
    func init() {
        stdlog = log.New(os.Stdout, "", log.Ldate|log.Ltime)
        errlog = log.New(os.Stderr, "", log.Ldate|log.Ltime)
    }
    func main() {
        c := cron.New()
        startCron(c)
        srv, err := daemon.New(name, description)
        if err != nil {
            errlog.Println("Error: ", err)
            os.Exit(1)
        }
        service := &Service{srv, *c}
        status, err := service.Manage()
        if err != nil {
            errlog.Println(status, "\nError: ", err)
            os.Exit(1)
        }
        fmt.Println(status)
    }

I am trying to simply run a daemon that starts a cronjob. I cannot see any examples of anything outside of reading from a channel so its unclear why this cron job is not being ran. Any ideas?
both sudo ./cronTool install and sudo ./cronTool start seem to do nothing.

Edit: it works fine with cron.Run() rather than cron.Start() but Run() blocks the daemon so I cannot detach reliably. Is there some issue with goroutines inside a daemon? I have tried keeping an event loop, passing cron into main or into the service struct. Everything seems to block or not execute

Set Darwin plist WorkingDirectory to where it was installed?

I have a service that has to get a couple files using relative import paths, however when I install on Darwin my local path goes to /usr/local/var/log or somewhere similar. Is there any way that could be set to wherever the install file went?

Question about switch-case `GOOS`

I'm a beginner of golang, daemon is a great project, let me create daemon program fast.
The interesting thing is that how daemon switch-case the GOOS ?

ps: Is it a trick of execPath or os.Executable()?

Invalid daemon kind specified

func main() {
srv, err := daemon.New(name, description, daemon.SystemDaemon)
if err != nil { // <-- Invalid daemon kind specified
errlog.Println("Error: ************************", err)
os.Exit(1)
}

service := &Service{srv}
status, err := service.Manage()
if err != nil {
	log.Fatal(status, "\nError: ", err)
}
fmt.Println(status)


rand.Seed(time.Now().UnixNano())

}

Flags in parametres don't work!

Hello! I read two topics about keys in parameters, when intsall service (like 'sudo ./myservice install -myflag "flagValue"'), but it didn't work!

Example here:
// Example of a daemon with echo service
package main

import (
"fmt"
"log"
"os"
"os/signal"
"syscall"
"github.com/takama/daemon"
"flag"
)

const (
// name of the service
name = "myservice"
description = "My Echo Service"
// port which daemon should be listen
port = ":9977"
)

//dependencies that are NOT required by the service, but might be used
var dependencies = []string{"dummy.service"}

var stdlog, errlog *log.Logger

// Service has embedded daemon
type Service struct {
daemon.Daemon
}

// Manage by daemon commands or run the daemon
func (service *Service) Manage() (string, error) {
usage := "Usage: myservice install | remove | start | stop | status"
// if received any kind of command, do it
if len(os.Args) > 1 {
command := os.Args[1]
switch command {
case "install":
return service.Install()
case "remove":
return service.Remove()
case "start":
return service.Start()
case "stop":
return service.Stop()
case "status":
return service.Status()
//default:
// return usage, nil
}
}
// Do something, call your goroutines, etc
var customFlag string
flag.StringVar(&customFlag, "c", customFlag, "custom flag")
flag.Parse()
stdlog.Println("custom flag is: ", customFlag)
// Set up channel on which to send signal notifications.
// We must use a buffered channel or risk missing the signal
// if we're not ready to receive when the signal is sent.
interrupt := make(chan os.Signal, 1)
signal.Notify(interrupt, os.Interrupt, os.Kill, syscall.SIGTERM)
// loop work cycle with accept connections or interrupt
// by system signal
for {
select {
case killSignal := <-interrupt:
stdlog.Println("Got signal:", killSignal)
if killSignal == os.Interrupt {
return "Daemon was interruped by system signal", nil
}
return "Daemon was killed", nil
}
}
// never happen, but need to complete code
return usage, nil
}
func init() {
f, err := os.OpenFile("/Users/myname/go/daemon/test.log", os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
if err != nil {
fmt.Printf("error opening file: %v", err)
}
stdlog = log.New(f, "", log.Ldate|log.Ltime)
errlog = log.New(f, "", log.Ldate|log.Ltime)
}
func main() {
srv, err := daemon.New(name, description, dependencies...)
if err != nil {
errlog.Println("Error: ", err)
os.Exit(1)
}
service := &Service{srv}
status, err := service.Manage()
if err != nil {
errlog.Println(status, "\nError: ", err)
os.Exit(1)
}
fmt.Println(status)
}

Maybe i do something wrong?
Thanks.

Generic issue for language fixes

This is a generic ticket for syntax fixes. Of course it's finite.

And the first one will be:

Status could not defined

that is returned by service.Status()

Will fix that shortly.

Windows, Service remove

Hi,
Service remove should be silent, currently when service.Remove() is called, NSSM show dialogue to ask to continue.

To remove a service without confirmation:

        nssm remove <servicename> confirm

Thanks

Ubuntu 14.04 go run main.go install, wrong path

Machine version

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 14.04.4 LTS
Release:	14.04
Codename:	trusty

go version
go version go1.5 linux/amd64

Well the generated config file is

ubuntu@workhorse-2:/etc/init$ cat myservice.conf
# myservice My Echo Service

description     "My Echo Service"
author          "Pichu Chen <[email protected]>"

start on runlevel [2345]
stop on runlevel [016]

#kill timeout 5

exec /tmp/go-build462925290/command-line-arguments/_obj/exe/main  >> /var/log/myservice.log 2>> /var/log/myservice.err

But there is no folder in /tmp by this id go-build462925290, there are folders by build462925291 and some more id's.
Logs from the service error file.

ubuntu@workhorse-2:/var/log$ tail -f myservice.err
/bin/sh: 1: exec: /tmp/go-build462925290/command-line-arguments/_obj/exe/main: not found
/bin/sh: 1: exec: /tmp/go-build462925290/command-line-arguments/_obj/exe/main: not found
/bin/sh: 1: exec: /tmp/go-build462925290/command-line-arguments/_obj/exe/main: not found
/bin/sh: 1: exec: /tmp/go-build462925290/command-line-arguments/_obj/exe/main: not found

so it should generate the path as /tmp/go-build462925291 /command-line-arguments/_obj/exe/main instead of /tmp/go-build462925290/command-line-arguments/_obj/exe/main

Problem service install in freebsd

Hello,
When installs the service, the program places the service in "/etc/init.d" in freebsd. But it does not exist because it is "/etc/rc.d".

For the moment I made an init.d link to rc.d but can you fix it?

After the service work.

Additional control of systemd service file creation

I want to add another field to the generated systemd file from the .Install service command.

specifically want to add: LimitNOFILE= so I can control the FD limit of the service. Can you expose that as an option?

daemon does not work in Ubuntu 16.04 LTS

Ubuntu 16.04 has systemd and upstart together. Upstart is still used for so-called "user" init (for the desktop as I understand)

ps aux | grep upstart
maxxant 1861 0.0 0.0 47700 4452 ? Ss ноя24 0:00 /sbin/upstart --user
maxxant 1934 0.0 0.0 34080 2020 ? S ноя24 0:00 upstart-udev-bridge --daemon --user
maxxant 1996 0.0 0.0 34016 336 ? S ноя24 0:04 upstart-dbus-bridge --daemon --system --user --bus-name system
maxxant 2001 0.0 0.0 42508 1708 ? S ноя24 0:00 upstart-file-bridge --daemon --user
maxxant 2003 0.3 0.0 34124 1392 ? S ноя24 30:36 upstart-dbus-bridge --daemon --session --user --bus-name session

I guess that it all had to work before change #28 which is primarily being tested for the presence of upstart and the second systemd.

I tried to fix it in maxxant@3030e65 and it works fine

What do you think about it?

Example

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

service still running when i "remove"

as you can see,i use subcommand "remove" to remove the daemon service,but the application didn't stopped, and there will be some trouble when type "status" to check status.
c2977fd7-be15-43d9-a059-6daa293389c6

execPath() don't defined on windows edition.

method execPath invoked in helper.go, but doesn't defined on daemon_windows.go.
BTW, if it's possible i would take seconds time for windows edition's implementation.
thanks.

no way to specify command line arguments

There seems to be no way to specify the command line arguments that are used to invoke the service. Although it is true that many applications can make use of a configuration file to load their settings, it is not always feasible or desirable to entirely avoid using any command line arguments when the daemon is invoked.

Have you given any thought to how this could be adjusted to accommodate that? From what I know of systemd and SystemV-style init scripts it would be fairly trivial to include command line arguments in the script itself (I don't know about the MacOS plist stuff but I assume that has similar functionality). If a way were provided to pass in the command line arguments to Install(), then the calling app could either take them from the actual command line that was called (minus the "install" argument) or provide defaults, etc.

What do you think about that idea?

Best, Brad

Add support for LaunchAgents on macOSX

Summary

I'd like to add support for LaunchAgents (user daemons in macOSX). Use case is I'd like to use this package to manage user daemons. Here's kind of the overview of the differences:

Screenshot 2020-04-15 at 16 08 55

Details

Currently this package supports only LaunchDaemons :

daemon/daemon.go

Lines 9 to 10 in aa76b00

This package is not provide implementation of user daemon,
accordingly must have root rights to install/remove service.

I'm wondering if you would consider adding support for LaunchAgents? Seems where we create the .plist file is the biggest difference (well, that and I guess permissions since it would run as the logged in user):

daemon/daemon_darwin.go

Lines 28 to 31 in aa76b00

// Standard service path for system daemons
func (darwin *darwinRecord) servicePath() string {
return "/Library/LaunchDaemons/" + darwin.name + ".plist"
}

I'd like to take a stab at adding support for this. So consider this a scoping exercise of sorts to:

  1. Gauge your interest - is this something you'd like me to contribute to your library?
  2. Get feedback on approach - before I write any code, wanna know: are you're ok with the approach below?

On approach, I'm thinking of updating darwinRecord to have an userAgent bool field ...

daemon/daemon_darwin.go

Lines 17 to 21 in aa76b00

type darwinRecord struct {
name string
description string
dependencies []string
}

Actual implementation might be slightly different but the idea is provide a way to know what type of deamon we want and then internally change the flow based on use case e.g. use /Library/LaunchAgents/ instead of /Library/LaunchDaemons/ when it's a user daemon, etc.

Lemme know what you think.

References

PID legacy directory /var/run/

Systemd journal contains this error. Service always stopped.

/etc/systemd/system/mysrv.service:7: PIDFile= references a path below legacy directory /var/run/, updating /var/run/mysrv.pid → /run/mysrv.pid; please update the unit file accordingly

Freebsd: Deamon don't work

Hello,
I'm testing takama/daemon and it don't work when I started my computer with the example.

[root@compile ~]# service -e
/usr/local/etc/rc.d/myservice
/etc/rc.d/hostid
....
[root@compile ~]# netstat -na |grep 99
[root@compile ~]#

When I start the service manually, it is works.
[root@compile ~]# service myservice start
[root@compile ~]# netstat -na |grep 99
tcp46 0 0 *.9977 . LISTEN

I make many tests and I don't undertand ❌

One Idea ?

Can I use EnvironmentFile argument in systemd?

I want to use viper that is configuration module.

viper.SetConfigName("config") // name of config file (without extension)
viper.AddConfigPath("/etc/appname/")   // path to look for the config file in
viper.AddConfigPath("$HOME/.appname")  // call multiple times to add many search paths
viper.AddConfigPath(".")               // optionally look for config in the working directory
err := viper.ReadInConfig() // Find and read the config file
if err != nil { // Handle errors reading the config file
	panic(fmt.Errorf("Fatal error config file: %s \n", err))
}

viper support environment path.

so I modified systemdConfig variable

var systemDConfig = `[Unit]
Description={{.Description}}
Requires={{.Dependencies}}
After={{.Dependencies}}

[Service]
EnvironmentFile={{.Path}}/.env
PIDFile=/var/run/{{.Name}}.pid
ExecStartPre=/bin/rm -f /var/run/{{.Name}}.pid
ExecStart={{.Path}} {{.Args}}
Restart=on-failure

[Install]
WantedBy=multi-user.target

However Path variable is including file name. not directory.

I want to get only directory path.

Windows, NSSM.EXE

Hi,
I wanted to use this package to have a portable solution to have Window Services like experience across multiple OS but it seems like it depends upon nssm to carry-on its work on windows. Is this only for windows or these kind of dependencies are in other OS implementations also.

Thanks

Support Upstart

Good day.

Sorry for my bad english, i'm in process learning. My native language russian.

I'm newbie in golang but i view your package. I tried to do on basis this of his demon and run it in linux mint. But the work was incorrect because in linux mint based system initialisation Upstart.

Tell me please, is it possible to add in this package support for Upstart?

PS: Of course, I try to do it myself, but my skill is very small )))

status checking doesn't work properly under OS X 10.12

Hello, I'm working under OS X 10.12.

When I installed a daemon with a non-executable name like "port 8082", daemon would create a file named /Library/LaunchDaemons/port_8082.plist with incorrect binary path.

I glanced the codes, it might be failed while calling exec.LookPath so which used filepath.Abs(os.Args[0]) instead. Even though a little bit of extra time, it's still easy to fix by using absolute path from command line. But, I found a issue, when I used status to check, it was returned Service is running..., that was incredible. The output of sudo launchctl list port_8082 is shown as below, I hope I've provided all necessary details, if not, please feel free to point out it.

BTW, my command's name is example which is located in GOPATH, PATH as well.

{
	"StandardOutPath" = "/usr/local/var/log/port_8082.log";
	"LimitLoadToSessionType" = "System";
	"StandardErrorPath" = "/usr/local/var/log/port_8082.err";
	"Label" = "port_8082";
	"TimeOut" = 30;
	"OnDemand" = false;
	"LastExitStatus" = 19968;
	"Program" = "/Users/vegertar/PycharmProjects/cdntoolkit/ctk/collect/example";
	"ProgramArguments" = (
		"/Users/vegertar/PycharmProjects/cdntoolkit/ctk/collect/example";
		"run";
		"http";
		":8082";
	);
};

Does not build for FreeBSD/386

When building on FreeBSD/amd64 for target GOARCH=386, example.go does not compile with the following errors:

/export/roman/go/src/github.com/takama/daemon/daemon.go:185: undefined: newDaemon
/export/roman/go/src/github.com/takama/daemon/daemon.go:190: undefined: execPath
/export/roman/go/src/github.com/takama/daemon/helper.go:46: undefined: execPath
/export/roman/go/src/github.com/takama/daemon/helper.go:50: undefined: execPath

Here is full output of % go build GOOS=freebsd GOARCH=386 takama-daemon.go

% uname -a ; gcc -v; env GOOS=freebsd GOARCH=386 go build -v -compiler gc takama-daemon.go
FreeBSD nas.home.lan 10.3-RELEASE-p11 FreeBSD 10.3-RELEASE-p11 #0: Mon Oct 24 18:49:24 UTC 2016 [email protected]:/usr/obj/usr/src/sys/GENERIC amd64
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc48/gcc/x86_64-portbld-freebsd10.1/4.8.5/lto-wrapper
Target: x86_64-portbld-freebsd10.1
Configured with: /wrkdirs/usr/ports/lang/gcc/work/gcc-4.8.5/configure --disable-bootstrap --disable-nls --enable-gnu-indirect-function --libdir=/usr/local/lib/gcc48 --libexecdir=/usr/local/libexec/gcc48 --program-suffix=48 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc48/include/c++/ --with-ld=/usr/local/bin/ld --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --with-ecj-jar=/usr/local/share/java/ecj-4.5.jar --enable-languages=c,c++,objc,fortran,java --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/info/gcc48 --build=x86_64-portbld-freebsd10.1
Thread model: posix
gcc version 4.8.5 (FreeBSD Ports Collection)
runtime/internal/sys
runtime/internal/atomic
runtime
sync/atomic
errors
internal/race
math
unicode
unicode/utf8
internal/nettrace
sync
io
syscall
internal/singleflight
bytes
strings
math/rand
strconv
time
reflect
os
vendor/golang_org/x/net/route
os/signal
fmt
sort
path/filepath
regexp/syntax
io/ioutil
context
text/template/parse
net/url
log
net
os/exec
regexp
text/template
github.com/takama/daemon

github.com/takama/daemon

/export/roman/go/src/github.com/takama/daemon/daemon.go:185: undefined: newDaemon
/export/roman/go/src/github.com/takama/daemon/daemon.go:190: undefined: execPath
/export/roman/go/src/github.com/takama/daemon/helper.go:46: undefined: execPath
/export/roman/go/src/github.com/takama/daemon/helper.go:50: undefined: execPath

No such issues when building for freebsd/amd64, linux/386, linux/arm, windows/386 and windows/amd64. Builds fine.

Not tested for others.

daemon service does not work in windows10

Attempting to start windows service results in a long pause and the following error returned:

Error: The service did not respond to the start or control request in a timely fashion.

run example on windows 10 failed

build example,use example.exe install,it run successfull,and create the service named myservice.
but when i use example start,it show the error like

Error:  The dependency service does not exist or has been marked for deletion.

the go env is:

set GOARCH=386
set GOBIN=
set GOCACHE=C:\Users\go\AppData\Local\go-build
set GOEXE=.exe
set GOHOSTARCH=386
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\msys64\home\go\core
set GORACE=
set GOROOT=D:\go
set GOTMPDIR=
set GOTOOLDIR=D:\go\pkg\tool\windows_386
set GCCGO=gccgo
set GO386=sse2
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m32 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\go\AppData\Local\Temp\go-build086027322=/tmp/go-build -gno-record-gcc-switches

daemon service does not work in suse11sp3

tag:1.0.0
os :Linux suse11SP3X64 3.0.76-0.11-default #1 SMP Fri Jun 14 08:21:43 UTC 2013 (ccab990) x86_64 x86_64 x86_64 GNU/Linux

##My execution order is as follows:

suse11SP3X64:~ # ./mytest remove
Removing My Echo Service:					[  OK  ]
suse11SP3X64:~ # ./mytest install
Install My Echo Service:					[  OK  ]
suse11SP3X64:~ # ./mytest start
Starting My Echo Service:					[  OK  ]
suse11SP3X64:~ # ./mytest status
Service is stopped
suse11SP3X64:~ # ./mytest stop
Stopping My Echo Service:					[FAILED] 
Error:  Service has already been stopped
suse11SP3X64:~ # ./mytest start
Starting My Echo Service:					[  OK  ]
suse11SP3X64:~ # ./mytest status
Service is stopped
suse11SP3X64:~ # ./mytest stop
Stopping My Echo Service:					[FAILED] 
Error:  Service has already been stopped
suse11SP3X64:~ # ./mytest status
Service is stopped
suse11SP3X64:~ # ./mytest status
Service is stopped
suse11SP3X64:~ # ./mytest start
Starting My Echo Service:					[FAILED] 
Error:  exit status 7
suse11SP3X64:~ # 

Some service scripts ignoring {{.Args}}

Optional args passed to Daemon.Install(args...) should be included on the exec line when the service is started. This is already the case for darwin and systemv (see daemon_darwin.go and daemon_linux_systemd.go) but it is not for the others.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.