mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
Add environment variable to inhibit restart
This commit is contained in:
parent
9b0768a71b
commit
043fa7f489
@ -41,7 +41,11 @@ var (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
usage = "syncthing [options]"
|
usage = "syncthing [options]"
|
||||||
extraUsage = `The following environemnt variables can be set to facilitate debugging:
|
extraUsage = `The following enviroment variables are interpreted by syncthing:
|
||||||
|
|
||||||
|
STNORESTART Do not attempt to restart when requested to, instead just exit.
|
||||||
|
Set this variable when running under a service manager such as
|
||||||
|
runit, launchd, etc.
|
||||||
|
|
||||||
STPROFILER Set to a listen address such as "127.0.0.1:9090" to start the
|
STPROFILER Set to a listen address such as "127.0.0.1:9090" to start the
|
||||||
profiler with HTTP access.
|
profiler with HTTP access.
|
||||||
@ -50,7 +54,7 @@ const (
|
|||||||
facility strings:
|
facility strings:
|
||||||
- "scanner" (the file change scanner)
|
- "scanner" (the file change scanner)
|
||||||
- "discover" (the node discovery package)
|
- "discover" (the node discovery package)
|
||||||
- "net" (connecting and disconnecting, sent/received messages)
|
- "net" (connecting and disconnecting, network messages)
|
||||||
- "idx" (index sending and receiving)
|
- "idx" (index sending and receiving)
|
||||||
- "need" (file need calculations)
|
- "need" (file need calculations)
|
||||||
- "pull" (file pull activity)`
|
- "pull" (file pull activity)`
|
||||||
@ -299,6 +303,12 @@ func main() {
|
|||||||
|
|
||||||
func restart() {
|
func restart() {
|
||||||
infoln("Restarting")
|
infoln("Restarting")
|
||||||
|
if os.Getenv("SMF_FMRI") != "" || os.Getenv("STNORESTART") != "" {
|
||||||
|
// Solaris SMF
|
||||||
|
infoln("Service manager detected; exit instead of restart")
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
env := os.Environ()
|
env := os.Environ()
|
||||||
if len(os.Getenv("STRESTART")) == 0 {
|
if len(os.Getenv("STRESTART")) == 0 {
|
||||||
env = append(env, "STRESTART=1")
|
env = append(env, "STRESTART=1")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user