I have followed this guide and everything seems to work.
The only problem I have I can not start or restart the "octoprint" service as user "octoprint" (yes the service and the user name are the same):
This is the fist time for me that FreeBSD is not reporting an error and not getting the job done, so that's why I post here.
I would like to understand what is the problem.
As root user no problem:
so I think it is a permission problem but I do not know what I can do to fix it.
Here some investigations I have done:
here octoprint looks good.
here my octoprint service:
other infos:
Many thanks in advance!
The only problem I have I can not start or restart the "octoprint" service as user "octoprint" (yes the service and the user name are the same):
Code:
$ service octoprint status
octoprint is running as pid 1202.
$ service octoprint stop
Stopping octoprint.
Waiting for PIDS: 1202.
$ service octoprint status
octoprint is not running.
$ service octoprint start
Starting octoprint.
$ service octoprint status
octoprint is not running.
$ service octoprint restart
octoprint not running?
Starting octoprint.
$ service octoprint status
octoprint is not running.
This is the fist time for me that FreeBSD is not reporting an error and not getting the job done, so that's why I post here.
I would like to understand what is the problem.
As root user no problem:
Code:
root@op_server:/ # service octoprint status
octoprint is not running.
root@op_server:/ # service octoprint start
Starting octoprint.
root@op_server:/ # service octoprint status
octoprint is running as pid 1202.
so I think it is a permission problem but I do not know what I can do to fix it.
Here some investigations I have done:
Code:
$ cd /usr/local/etc/rc.d/
$ ls -l
total 23
-rwxr-xr-x 1 root wheel 689 Oct 17 01:33 git_daemon
-rwxr-xr-x 1 root wheel 1954 Oct 28 20:11 octoprint
-rwxr-xr-x 1 root wheel 1021 Oct 17 01:26 svnserve
-rwxr-xr-x 1 root wheel 1239 Sep 17 06:24 tcsd
-rwxr-xr-x 1 root wheel 628 Sep 17 06:21 tpmd
here octoprint looks good.
Code:
$ id
uid=1002(octoprint) gid=1002(octoprint) groups=1002(octoprint),5(operator),68(dialer)
here my octoprint service:
Code:
#!/bin/sh
# PROVIDE: octoprint
# REQUIRE: NETWORKING
# KEYWORD: shutdown
# *******DESCRIPTION: FreeBSD 12.1 - rc.d script for the 3D Printer Software OctoPrint. This script takes advantage of FreeBSD's rc.subr framework to start OctoPrint automatically at startup and to allow it to be controlled as a FreeBSD service (eg. service octoprint start). This script assumes you are running OctoPrint as a virtual python environment (py27-virtualenv), but it can easily be changed if you want.
# *******HELP:
# 1. To increase security we want to avoid running it as root so create a user named "octoprint" (or any name you want but then change the script to reflect the change) and add the user to the "dialer" group so it can access the USB serial port that connects to the 3D Printer.
# 2. Add the line "octoprint_enable="YES"" to the end of "etc/rc.conf" this will enable and start OctoPrint at boot time.
# 3. Place this rc.d script file in "/usr/local/etc/rc.d/" (make sure this file is executable, if not run: "chmod +x /usr/local/etc/rc.d/octoprint")
# 4. Make sure the variables below such as, "command", "octoprint_basedir", "command_interpreter", etc..., reflect the correct paths to your octoprint executable, base directory, and virtual python executable (if you are using a virtual python environment like this script does).
# 5. After startup the service can be controlled like any other service "service octoprint {start,status,reset,stop,start}"
. /etc/rc.subr
name=octoprint
rcvar="octoprint_enable"
: ${octoprint_enable:=no}
octoprint_user=octoprint
octoprint_group=${octoprint_user}
octoprint_user_path="/usr/home/${octoprint_user}"
octoprint_basedir="${octoprint_user_path}/.octoprint"
command_interpreter="${octoprint_user_path}/OctoPrint/venv/bin/python3.7"
command="${octoprint_user_path}/OctoPrint/venv/bin/${name}"
command_args="serve --basedir ${octoprint_basedir} > /dev/null 2>&1 &"
load_rc_config $name
run_rc_command "$1"
other infos:
Code:
$ ls -l OctoPrint/venv/bin/python3.7
-rwxrwxr-x 1 root octoprint 15208 Oct 28 17:23 OctoPrint/venv/bin/python3.7
$ ls -l OctoPrint/venv/bin/octoprint
-rwxr-xr-x 1 octoprint octoprint 240 Nov 30 21:53 OctoPrint/venv/bin/octoprint
$
Many thanks in advance!