Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
0830c728
Commit
0830c728
authored
Jan 09, 2016
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove pidfile when program exits (closes #495)
parent
dab679df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
caddy/sigtrap.go
caddy/sigtrap.go
+8
-0
caddy/sigtrap_posix.go
caddy/sigtrap_posix.go
+6
-0
No files found.
caddy/sigtrap.go
View file @
0830c728
...
...
@@ -32,10 +32,18 @@ func trapSignalsCrossPlatform() {
if
i
>
0
{
log
.
Println
(
"[INFO] SIGINT: Force quit"
)
if
PidFile
!=
""
{
os
.
Remove
(
PidFile
)
}
os
.
Exit
(
1
)
}
log
.
Println
(
"[INFO] SIGINT: Shutting down"
)
if
PidFile
!=
""
{
os
.
Remove
(
PidFile
)
}
go
os
.
Exit
(
executeShutdownCallbacks
(
"SIGINT"
))
}
}()
...
...
caddy/sigtrap_posix.go
View file @
0830c728
...
...
@@ -20,6 +20,9 @@ func trapSignalsPosix() {
switch
sig
{
case
syscall
.
SIGTERM
:
log
.
Println
(
"[INFO] SIGTERM: Terminating process"
)
if
PidFile
!=
""
{
os
.
Remove
(
PidFile
)
}
os
.
Exit
(
0
)
case
syscall
.
SIGQUIT
:
...
...
@@ -30,6 +33,9 @@ func trapSignalsPosix() {
log
.
Printf
(
"[ERROR] SIGQUIT stop: %v"
,
err
)
exitCode
=
1
}
if
PidFile
!=
""
{
os
.
Remove
(
PidFile
)
}
os
.
Exit
(
exitCode
)
case
syscall
.
SIGHUP
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment