Hello,
Kopia server sussessfuly start and working on FreeBSD from ssh console.
But when it started from autorun script /etc/rc.local
it started but not accept client connection .
How to autostart kopia server on FreeBSD?
Start command -
/usr/local/bin/kopia server start
–tls-cert-file /root/my.cert
–tls-key-file /root/my.key
–address 0.0.0.0:51515
–server-control-username ctl
–server-control-password xxxx &
Thank you for answer.
but
when starting kopia from /etc/rc.local system not send SIGHUP signal
kopia reload config when receive SIGHUP signal (not stop)
I try this with NO SUCESS
cat /etc/rc.local
( nohup /usr/local/bin/kopia server start
–tls-cert-file /root/my.cert
–tls-key-file /root/my.key
–address 0.0.0.0:51515
–server-control-username control
–server-control-password xxxxx 2>&1 ) >> /var/log/kopia-srv.log &
iBackup
December 16, 2023, 9:21pm
4
When you run programs from rc.local or from cron, always use full path to a program, keep also in mind that FreeBSD default shell isn’t a bash. Also use \ as the last character when you split command across multiple lines
( /usr/bin/nohup /usr/local/bin/kopia server start \
–tls-cert-file /root/my.cert \
–tls-key-file /root/my.key \
–address 0.0.0.0:51515 \
–server-control-username control \
–server-control-password xxxxx 2>&1 >> /var/log/kopia-srv.log ) &
and make sure that rc.local has executable bit set
iBackup
December 16, 2023, 9:28pm
5
nohup isn’t about SIGHUP
It about : “invoke a utility immune to hangups”
Thank you for answer, but no success after rc.local correction.
Kopia started but not accept connection from network
ps -ax
…
753 v0- I 0:00.08 /usr/local/bin/kopia server start --tls-cert-file /root/my.cert --tls-key-file /root/my.key --address 0.0.0.0:51515 --server-control-username control --server-control
…
elel
December 25, 2023, 11:11pm
7
Maybe the documentation is out of date. Kopia 0.15.0 shows different syntax:
./kopia server start --help
<snip>
--address="http://127.0.0.1:51515"
iBackup
December 26, 2023, 6:02am
8
I can’t see the option --config-file that points to config file. When you run a program from rc.local, that program has no home, no PATH, nothing, you have to feed the program with all paths
Thank you very much,
–config-file=/root/.config/kopia/repository.config solve the problem.
This is complete freebsd startup rc.d script
#!/bin/sh
# PROVIDE: kopia
# REQUIRE: NETWORKING zfs
# KEYWORD: shutdown
. /etc/rc.subr
name="kopia"
rcvar="kopia_enable"
kopia_user="root"
kopia_command="/usr/local/bin/kopia server start \
--tls-cert-file /usr/local/kopia/kopia.cert \
--tls-key-file /usr/local/kopia/kopia.key \
--address 0.0.0.0:51515 \
--server-control-username kopia \
--server-control-password stongpasswordhere \
--log-dir=/var/log/kopia \
--config-file=/root/.config/kopia/repository.config \
--ui "
pidfile="/var/run/${name}.pid"
command="/usr/sbin/daemon"
command_args="-P ${pidfile} -r -f ${kopia_command}"
load_rc_config $name
: ${kopia_enable:="NO"}
run_rc_command "$1"