From a26c6dae11e21d9010e25c5748d84ec18b6ab920 Mon Sep 17 00:00:00 2001 From: Igor Dolzhikov Date: Sat, 18 Jul 2015 12:22:24 +0600 Subject: [PATCH 1/2] used name of service as base name in linux system V --- README.md | 2 +- daemon.go | 8 +++++--- daemon_linux_systemv.go | 2 +- example/myservice.go | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1bf4159..80ad208 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ import ( const ( - // name of the service, match with executable file name + // name of the service name = "myservice" description = "My Echo Service" diff --git a/daemon.go b/daemon.go index aa066f6..0a687b6 100644 --- a/daemon.go +++ b/daemon.go @@ -28,7 +28,7 @@ Example: const ( - // name of the service, match with executable file name + // name of the service name = "myservice" description = "My Echo Service" @@ -152,6 +152,8 @@ Go daemon */ package daemon +import "strings" + // Daemon interface has standard set of a methods/commands type Daemon interface { @@ -173,8 +175,8 @@ type Daemon interface { // New - Create a new daemon // -// name: name of the service, match with executable file name; +// name: name of the service // description: any explanation, what is the service, its purpose func New(name, description string) (Daemon, error) { - return newDaemon(name, description) + return newDaemon(strings.Join(strings.Fields(name), "_"), description) } diff --git a/daemon_linux_systemv.go b/daemon_linux_systemv.go index 44b044d..1aed0a7 100644 --- a/daemon_linux_systemv.go +++ b/daemon_linux_systemv.go @@ -228,7 +228,7 @@ fi exec="{{.Path}}" servname="{{.Description}}" -proc=$(basename $exec) +proc="{{.Name}}" pidfile="/var/run/$proc.pid" lockfile="/var/lock/subsys/$proc" stdoutlog="/var/log/$proc.log" diff --git a/example/myservice.go b/example/myservice.go index 6b58241..a4657dd 100644 --- a/example/myservice.go +++ b/example/myservice.go @@ -14,7 +14,7 @@ import ( const ( - // name of the service, match with executable file name + // name of the service name = "myservice" description = "My Echo Service" From 3ee88255ed66af41c05e48a51f3b74e202067d19 Mon Sep 17 00:00:00 2001 From: Igor Dolzhikov Date: Sat, 18 Jul 2015 12:22:58 +0600 Subject: [PATCH 2/2] Bumped version number to 0.2.12 --- daemon.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon.go b/daemon.go index 0a687b6..823517e 100644 --- a/daemon.go +++ b/daemon.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. /* -Package daemon 0.2.11 for use with Go (golang) services. +Package daemon 0.2.12 for use with Go (golang) services. Package daemon provides primitives for daemonization of golang services. This package is not provide implementation of user daemon,