# option compression '0'
# option debug '0'
# option http '1'
+
+ # Advanced options. Modify at your own risk.
+
+ # More info: https://go.dev/doc/gc-guide#GOGC
+ # option gc '0'
+
+ # Max number of OS threads to use
+ # 0 to match the number of CPUs (default)
+ # >0 to explicitly specify concurrency
+ # option maxprocs '0'
+
+ # Soft memory limit in MB, 0 to disable
+ # option memlimit '0'
#!/bin/sh /etc/rc.common
+#
+# shellcheck disable=SC3043 # ash supports local
START=90
STOP=10
local db_dir="$conf_dir/discovery.db"
local db_flush_interval=''
local debug=0
+ local gc=0
local http=0
local key="$conf_dir/key.pem"
local listen=':8443'
+ local maxprocs=0
+ local memlimit=0
local metrics_listen=''
local nice=0
local user='syncthing'
procd_open_instance
procd_set_param command "$PROG"
+
+ [ "$gc" -le 0 ] || procd_append_param env GOGC="$gc"
+ [ "$maxprocs" -le 0 ] || procd_append_param env GOMAXPROCS="$maxprocs"
+ [ "$memlimit" -le 0 ] || procd_append_param env GOMEMLIMIT="$memlimit"
+
procd_append_param command --cert="$cert"
[ "$compression" -eq 0 ] || \
procd_append_param command --compression
# option debug '0'
# option nat '0'
# option pprof '0'
+
+ # Advanced options. Modify at your own risk.
+
+ # More info: https://go.dev/doc/gc-guide#GOGC
+ # option gc '0'
+
+ # Max number of OS threads to use
+ # 0 to match the number of CPUs (default)
+ # >0 to explicitly specify concurrency
+ # option maxprocs '0'
+
+ # Soft memory limit in MB, 0 to disable
+ # option memlimit '0'
#!/bin/sh /etc/rc.common
+#
+# shellcheck disable=SC3043 # ash supports local
START=90
STOP=10
local enabled=0
local debug=0
local ext_address=''
+ local gc=0
local global_rate=''
local keys='/etc/strelaysrv'
local listen=':22067'
+ local maxprocs=0
+ local memlimit=0
local message_timeout=''
local nat=0
local nat_lease=''
procd_open_instance
procd_set_param command "$PROG"
- [ "$debug" -eq 0 ] || \
- procd_append_param command -debug
+
+ [ "$gc" -le 0 ] || procd_append_param env GOGC="$gc"
+ [ "$maxprocs" -le 0 ] || procd_append_param env GOMAXPROCS="$maxprocs"
+ [ "$memlimit" -le 0 ] || procd_append_param env GOMEMLIMIT="$memlimit"
+
+ [ "$debug" -eq 0 ] || procd_append_param command -debug
[ -z "$ext_address" ] || \
procd_append_param command -ext-address="$ext_address"
[ -z "$global_rate" ] || \
# "restart": the service has to be stopped/started for those to take effect.
option nice '19'
- # 0 to match the number of CPUs (default)
- # >0 to explicitly specify concurrency
- option maxprocs '0'
-
# More info: https://docs.syncthing.net/users/syncthing.html
# option db_delete_retention_interval ''
# option db_maintenance_interval ''
option log_max_old_files '7'
# Size in bytes
option log_max_size '1048576'
+
+ # Advanced options. Modify at your own risk.
+
+ # More info: https://go.dev/doc/gc-guide#GOGC
+ # option gc '0'
+
+ # Max number of OS threads to use
+ # 0 to match the number of CPUs (default)
+ # >0 to explicitly specify concurrency
+ # option maxprocs '0'
+
+ # Soft memory limit in MB, 0 to disable
+ # option memlimit '0'
#!/bin/sh /etc/rc.common
+#
+# shellcheck disable=SC3043 # ash supports local
START=90
STOP=10
local enabled=0
local db_delete_retention_interval=''
local db_maintenance_interval=''
+ local gc=0
local gui_address='http://0.0.0.0:8384'
local gui_apikey=''
local home='/etc/syncthing'
local log_max_old_files=7
local log_max_size=1048576
local maxprocs=0
+ local memlimit=0
local nice=0
local user='syncthing'
config_load 'syncthing'
- local group=$(id -gn $user)
-
[ "$enabled" -gt 0 ] || return 0
+ local group=$(id -gn $user)
+
mkdir -p "$home"
# A separate step to handle an upgrade use case
[ -d "$home" ] && chown -R $user:$group "$home"
- # Changes to "niceness"/maxprocs are not picked up either by reload_config
- # or by restart: the service has to be stopped/started for it to take effect
- if [ $maxprocs -le 0 ]; then
- # Default to the number of cores in this case
- maxprocs=$(grep -c ^processor /proc/cpuinfo)
- fi
-
procd_open_instance
+
procd_set_param command "$PROG"
- procd_set_param env GOMAXPROCS="$maxprocs"
+
+ [ "$gc" -le 0 ] || procd_append_param env GOGC="$gc"
+ [ "$maxprocs" -le 0 ] || procd_append_param env GOMAXPROCS="$maxprocs"
+ [ "$memlimit" -le 0 ] || procd_append_param env GOMEMLIMIT="$memlimit"
+
procd_append_param command serve
[ -z "$db_delete_retention_interval" ] || \
procd_append_param command --db-delete-retention-interval="$db_delete_retention_interval"
procd_set_param respawn
procd_set_param stdout 0
procd_set_param stderr 1
+
procd_close_instance
}