Solved Service does not exist or is not executable

axeflayer

New Member


Messages: 2

I am setting up a gemini protocol server written in go called "molly brown" link to git repository.

I have placed its bianary file in /usr/local/sbin/molly-brown

I placed its initscript at /etc/rc.d/molly

This is its initscript:
Code:
#!/bin/s#!/bin/s#!/bin/s#!/bin/s#!/bin/s#!/bin/s#!/bin/sh
#
# $FreeBSD$
#
 
# PROVIDE: molly
# REQUIRE: networking
# KEYWORD: shutdown  

. /etc/rc.subr

name="molly"
desc="Gemini Protocol daemon"
rcvar="molly_enable"
command="/usr/local/sbin/molly-brown"
command_args="-c /etc/molly.conf"
molly_brown_user="daemon"
pidfile="/var/run/${name}.pid"
required_files="/etc/molly.conf"

start_cmd="molly_start"
stop_cmd="molly_stop"  
status_cmd="molly_status"

molly_start() {
        /usr/sbin/daemon -P ${pidfile} -r -f -u $molly_brown_user $command
}
 
molly_stop() {
        if [ -e "${pidfile}" ]; then
                kill -s TERM `cat ${pidfile}`
        else
                echo "${name} is not running"
        fi

}
 
molly_status() {
        if [ -e "${pidfile}" ]; then
                echo "${name} is running as pid `cat ${pidfile}`"
        else
                echo "${name} is not running"
        fi
}
 
load_rc_config $name
run_rc_command "$1"

I added molly_enable="YES" to /etc/rc.conf

Here is my rc.conf
Code:
hostname="coot"
ifconfig_DEFAULT="DHCP"
sshd_enable="YES"
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
growfs_enable="YES"
pf_enable="YES"
pflog_enable="YES"
apache24_enable="YES"
ntpd_enable="YES"
molly_enable="YES"

When I run service molly start I get this output:
Code:
molly does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d), or is not executable

It is possible to start the server by going to /usr/local/sbin/molly-brown and typing molly-brown

I am not sure what is going wrong. Please note that I am new to Freebsd and this forum.
 

Tieks

Well-Known Member

Reaction score: 128
Messages: 307

Similarly, your config file should be in /usr/local/etc. You will always find installed applications under /usr/local. This will keep FreeBSD's system/userland separated from applications.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,764
Messages: 39,366

Your service should default to NO too.

Code:
: ${molly_enable:="NO}
 
OP
A

axeflayer

New Member


Messages: 2

Is this a copy & paste error or is it a verbatim copy from the shell script?


Also check if the file is allowed execution. At least it should be mode 555. Furthermore, base system external rc(8) scripts should be placed in /usr/local/etc/rc.d.
Yes, that must be a copy and paste error as it does not look like that in my initscript. I think changing the file permissions and making the bianary file executable fixed my problem. I also moved the files to their proper directories.
 
Top