File tree Expand file tree Collapse file tree 2 files changed +39
-33
lines changed Expand file tree Collapse file tree 2 files changed +39
-33
lines changed Original file line number Diff line number Diff line change @@ -8,42 +8,9 @@ import (
88 "mjpclab.dev/ghfs/src/serverLog"
99 "mjpclab.dev/ghfs/src/setting"
1010 "mjpclab.dev/ghfs/src/version"
11- "os"
12- "os/signal"
1311 "strconv"
14- "syscall"
1512)
1613
17- func cleanupOnEnd (appInst * app.App ) {
18- chSignal := make (chan os.Signal )
19- signal .Notify (chSignal , syscall .SIGINT , syscall .SIGTERM )
20-
21- go func () {
22- <- chSignal
23- appInst .Shutdown ()
24- }()
25- }
26-
27- func reInitOnHup (appInst * app.App ) {
28- chSignal := make (chan os.Signal )
29- signal .Notify (chSignal , syscall .SIGHUP )
30-
31- go func () {
32- for range chSignal {
33- errs := appInst .ReOpenLog ()
34- if serverError .CheckError (errs ... ) {
35- appInst .Shutdown ()
36- break
37- }
38- errs = appInst .ReLoadCertificates ()
39- if serverError .CheckError (errs ... ) {
40- appInst .Shutdown ()
41- break
42- }
43- }
44- }()
45- }
46-
4714func Main () (ok bool ) {
4815 // params
4916 params , printVersion , printHelp , errs := param .ParseFromCli ()
Original file line number Diff line number Diff line change 1+ package src
2+
3+ import (
4+ "mjpclab.dev/ghfs/src/app"
5+ "mjpclab.dev/ghfs/src/serverError"
6+ "os"
7+ "os/signal"
8+ "syscall"
9+ )
10+
11+ func cleanupOnEnd (appInst * app.App ) {
12+ chSignal := make (chan os.Signal )
13+ signal .Notify (chSignal , syscall .SIGINT , syscall .SIGTERM )
14+
15+ go func () {
16+ <- chSignal
17+ appInst .Shutdown ()
18+ }()
19+ }
20+
21+ func reInitOnHup (appInst * app.App ) {
22+ chSignal := make (chan os.Signal )
23+ signal .Notify (chSignal , syscall .SIGHUP )
24+
25+ go func () {
26+ for range chSignal {
27+ errs := appInst .ReOpenLog ()
28+ if serverError .CheckError (errs ... ) {
29+ appInst .Shutdown ()
30+ break
31+ }
32+ errs = appInst .ReLoadCertificates ()
33+ if serverError .CheckError (errs ... ) {
34+ appInst .Shutdown ()
35+ break
36+ }
37+ }
38+ }()
39+ }
You can’t perform that action at this time.
0 commit comments