takama / daemon

A daemon package for use with Go (golang) services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ubuntu 14.04 go run main.go install, wrong path

hemc4 opened this issue · comments

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 <pichu@tih.tw>"

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

I cant verify this in nearest time, but maybe somebody check who use ubuntu 14.04

The template in that line is:
exec {{.Path}} {{.Args}} >> /var/log/{{.Name}}.log 2>> /var/log/{{.Name}}.err

and {{.Path}} should be executable binary, so use go build and run it, don't use go run.