takama / daemon

A daemon package for use with Go (golang) services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Freebsd: Deamon don't work

Archie1978 opened this issue · comments

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 ?

Could you explain your example with code which used daemon service?
Did you use install the service before?

The code is the real example in https://github.com/takama/daemon.

Actually, I install daemon example in /bin/daemon.
Then I install daemon by "/bin/daemon install" and start service "service myservice start "
The program start correctly, I see the port 9977 open in netstat.

I have enabled debug mode in RC.
[root@compile ~]# service myservice start
/usr/local/etc/rc.d/myservice: DEBUG: pid file (/var/run/myservice.pid): not readable.
/usr/local/etc/rc.d/myservice: DEBUG: checkyesno: myservice_enable is set to YES.
/usr/local/etc/rc.d/myservice: DEBUG: run_rc_command: doit: myservice_start

Then I active myservice in reboot in the /etc/rc file.
myservice_enable="YES"

When it restarts, I see the service git but not myservice in /var/log/messages
I change permission on my service for 555 like git_daemon.
[root@compile ~]# ls -lrt /usr/local/etc/rc.d/
total 8
-r-xr-xr-x 1 root wheel 413 Nov 18 19:46 myservice
-r-xr-xr-x 1 root wheel 678 Dec 24 02:29 git_daemon

The most bizarre trick is when I rename the /bin/myservice program to /bin/myservice.app and I create "sh" script for starting myservice.app. The programme starting Oo.

I used
[root@compile ~]# uname -a
FreeBSD compile 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64

The last changes corrected the worry.
I reopen a ticket to you on another issue.