Autostart kopia server on freebsd

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 &

Use nohup to start it up

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 &

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

nohup isn’t about SIGHUP :slight_smile:
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

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"  

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