# cannot stop service



## kristoferus75 (Mar 20, 2022)

Hi !

I cannot stop this service with 

service librenms stop

and also i cannot stop the jail with this service

I have copied this file to /usr/local/etc/rc.d/librenms and i have enabled the service in rc.conf

What is wrong ?

Thanks



```
[CODE=bash]#!/bin/sh



# PROVIDE: librenms


# REQUIRE: SERVERS mysql


# KEYWORD: shutdown


#


# Add the following lines to /etc/rc.conf.local or /etc/rc.conf


# to enable this service:


#


# librenms_enable:      Set to NO by default.


#                       Set it to YES to enable librenms


# librenms_user:        The user account used to run the daemon.


#                       Default: www


# librenms_group:       The group account used to run the daemon.


#                       Default: www


# librenms_pid:         Path of the pid file.


#                       Default /var/run/librenms/librenms.pid


# librenms_daemonflags: Flags passed to daemon(8), overwrite this to use eg syslog


#                       Default "-o /var/log/librenms/librenms-service.log"


#


# Contributed by: Dries Michiels (driesm@FreeBSD.org)



. /etc/rc.subr



name=librenms


rcvar="${name}_enable"



load_rc_config $name



: ${librenms_enable:="NO"}


: ${librenms_user:="www"}


: ${librenms_group:="www"}


: ${librenms_pid:="/var/run/librenms/librenms.pid"}


: ${librenms_daemonflags:="-o /var/log/$name-service.log"}



pidfile="$librenms_pid"


procname="/usr/local/bin/python3.8"


command="/usr/sbin/daemon"



start_precmd=librenms_precmd



librenms_precmd()


{


        [ -f /var/log/$name-service.log ] || install -g $librenms_group -o $librenms_user -m 644 /dev/null /var/log/$name-service.log


        [ -f /var/log/$name.log ]         || install -g $librenms_group -o $librenms_user -m 644 /dev/null /var/log/$name.log


}



command_args="$librenms_daemonflags -p $pidfile $procname /usr/opt/librenms/librenms-service.py"



run_rc_command "$1"
```
[/CODE]


----------



## ralphbsz (Mar 20, 2022)

I'm not going to debug this for you, just giving a hint for how to help others debug it:



kristoferus75 said:


> I cannot stop this service with ...
> and also i cannot stop the jail with this service ...


What do you mean when you say "I cannot stop"? What happens? Do you get an error message? Could you maybe tell us the error message? What is this librenms service? How does one determine whether it is running or not? 

And then you say "the jail". What jail? Is the service running in a jail? You have told us nothing about the jail configuration.

Have you checked that all the file paths mentioned in the config file actually exists? Does the user www exist? Are permissions sensible?


----------

