Path of config.xml (home/syncthing/.config/syncthing)

Hi, i would like to know if we can change the default path of the config.xml ?

I want to put it in an other directory (/etc/…)

Take a look at syncthing -h to view help and you will find this option:

-home="" Set configuration directory

How did i use the -h ? when i write syncthing -h it only give me this : /usr/sbin/syncthing {start|stop|status|restart|uninstall}

Maybe it’s my script to put syncthing in service. Don’t know, but thanks.

Yeah, you’re running some script which runs Syncthing as a service. Open up that file, see how it calls Syncthing. Add the -h switch as necessary

Ok, got it, thank you ! I take a look on this, and if i’m trouble i will say in this topic.

Check also syncthing(1): http://docs.syncthing.net/users/syncthing.html

Ok well i can’t solve my problem by myself.

Here it is my script to run Syncthing :

#!/bin/sh
### BEGIN INIT INFO
# Provides: syncthing
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Multi-user daemonized version of syncthing.
# Description: Starts the syncthing daemon for all registered users.
### END INIT INFO

# Replace with users you want to run syncthing clients for
USER=root
DAEMON=/usr/sbin/syncthing
CONFDIR=/var/lib/syncthing

if [ -f /etc/sysconfig/$DAEMON ];then
        . /etc/sysconfig/$DAEMON
fi

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "$NETWORKING" = "no" ] && exit 0

startd() {
      echo "Starting syncthing"
      daemon --user $USER "nohup ${DAEMON} -home ${CONFDIR} /var/log/syncthing.log 2>&1 &"
}
stopd() {
    dbpid=$(pidofproc $DAEMON)
    if [ ! -z "$dbpid" ]; then
      echo "Stopping syncthing"
      killproc $DAEMON
    else
      echo "syncthing is not running"
    fi

}

status() {
    dbpid=$(pidofproc $DAEMON)
    if [ -z "$dbpid" ]; then
     echo "syncthing: not running."
    else
      echo "syncthing: running (pid $dbpid)"
    fi
}

case "$1" in
  start) startd
    ;;
  stop) stopd
    ;;
  restart|reload|force-reload) stopd && startd
    ;;
  status) status
    ;;
  *) echo "Usage: /etc/init.d/syncthing {start|stop|reload|force-reload|restart|status}"
     exit 1
   ;;
esac

exit 0

change line

CONFDIR=/var/lib/syncthing

to

CONFDIR=/my/new/path

and make sure to copy the config.xml from the old folder if you want to keep your settings

Ok nice, thank you !

This is a bad idea. You should run Syncthing as an unprivileged user instead.

I run in root just for some test, normaly i use my user syncthing

Well, i know now which line i have to modify, but the problem is confdir is going on /var/lib/syncthing, but i don't have these files, my syncthing's files are in /etc/init.d and home/syncthing, so is that path work (for the confdir) or is it just bugged or wrong line ?

No one know how to fix this problem with confdir ? (i’m on SME Server, based on Centos 6.5)