mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 14:50:56 +00:00
Add environment variable to inhibit restart
This commit is contained in:
parent
9b0768a71b
commit
043fa7f489
@ -41,19 +41,23 @@ 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:
|
||||||
|
|
||||||
STPROFILER Set to a listen address such as "127.0.0.1:9090" to start the
|
STNORESTART Do not attempt to restart when requested to, instead just exit.
|
||||||
profiler with HTTP access.
|
Set this variable when running under a service manager such as
|
||||||
|
runit, launchd, etc.
|
||||||
|
|
||||||
STTRACE A comma separated string of facilities to trace. The valid
|
STPROFILER Set to a listen address such as "127.0.0.1:9090" to start the
|
||||||
facility strings:
|
profiler with HTTP access.
|
||||||
- "scanner" (the file change scanner)
|
|
||||||
- "discover" (the node discovery package)
|
STTRACE A comma separated string of facilities to trace. The valid
|
||||||
- "net" (connecting and disconnecting, sent/received messages)
|
facility strings:
|
||||||
- "idx" (index sending and receiving)
|
- "scanner" (the file change scanner)
|
||||||
- "need" (file need calculations)
|
- "discover" (the node discovery package)
|
||||||
- "pull" (file pull activity)`
|
- "net" (connecting and disconnecting, network messages)
|
||||||
|
- "idx" (index sending and receiving)
|
||||||
|
- "need" (file need calculations)
|
||||||
|
- "pull" (file pull activity)`
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@ -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…
Reference in New Issue
Block a user