Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
7a497fd6
Commit
7a497fd6
authored
Dec 01, 2017
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move systemd ready notification to server.go
parent
94446fb8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
36 deletions
+28
-36
pkg/cmd/grafana-server/server.go
+28
-2
pkg/util/sdnotify.go
+0
-34
No files found.
pkg/cmd/grafana-server/server.go
View file @
7a497fd6
...
@@ -3,7 +3,9 @@ package main
...
@@ -3,7 +3,9 @@ package main
import
(
import
(
"context"
"context"
"flag"
"flag"
"fmt"
"io/ioutil"
"io/ioutil"
"net"
"os"
"os"
"path/filepath"
"path/filepath"
"strconv"
"strconv"
...
@@ -29,7 +31,6 @@ import (
...
@@ -29,7 +31,6 @@ import (
"github.com/grafana/grafana/pkg/social"
"github.com/grafana/grafana/pkg/social"
"github.com/grafana/grafana/pkg/tracing"
"github.com/grafana/grafana/pkg/tracing"
"github.com/grafana/grafana/pkg/util"
)
)
func
NewGrafanaServer
()
models
.
GrafanaServer
{
func
NewGrafanaServer
()
models
.
GrafanaServer
{
...
@@ -97,7 +98,7 @@ func (g *GrafanaServerImpl) Start() {
...
@@ -97,7 +98,7 @@ func (g *GrafanaServerImpl) Start() {
return
return
}
}
util
.
SdNotif
y
(
"READY=1"
)
SendSystemdRead
y
(
"READY=1"
)
g
.
startHttpServer
()
g
.
startHttpServer
()
}
}
...
@@ -171,3 +172,28 @@ func (g *GrafanaServerImpl) writePIDFile() {
...
@@ -171,3 +172,28 @@ func (g *GrafanaServerImpl) writePIDFile() {
g
.
log
.
Info
(
"Writing PID file"
,
"path"
,
*
pidFile
,
"pid"
,
pid
)
g
.
log
.
Info
(
"Writing PID file"
,
"path"
,
*
pidFile
,
"pid"
,
pid
)
}
}
func
SendSystemdReady
(
state
string
)
error
{
notifySocket
:=
os
.
Getenv
(
"NOTIFY_SOCKET"
)
if
notifySocket
==
""
{
return
fmt
.
Errorf
(
"NOTIFY_SOCKET environment variable empty or unset."
)
}
socketAddr
:=
&
net
.
UnixAddr
{
Name
:
notifySocket
,
Net
:
"unixgram"
,
}
conn
,
err
:=
net
.
DialUnix
(
socketAddr
.
Net
,
nil
,
socketAddr
)
if
err
!=
nil
{
return
err
}
_
,
err
=
conn
.
Write
([]
byte
(
state
))
conn
.
Close
()
return
err
}
pkg/util/sdnotify.go
deleted
100644 → 0
View file @
94446fb8
package
util
import
(
"errors"
"net"
"os"
)
var
NoNotifySocket
=
errors
.
New
(
"NOTIFY_SOCKET environment variable empty or unset."
)
func
SdNotify
(
state
string
)
error
{
notifySocket
:=
os
.
Getenv
(
"NOTIFY_SOCKET"
)
if
notifySocket
==
""
{
return
NoNotifySocket
}
socketAddr
:=
&
net
.
UnixAddr
{
Name
:
notifySocket
,
Net
:
"unixgram"
,
}
conn
,
err
:=
net
.
DialUnix
(
socketAddr
.
Net
,
nil
,
socketAddr
)
if
err
!=
nil
{
return
err
}
_
,
err
=
conn
.
Write
([]
byte
(
state
))
conn
.
Close
()
return
err
}
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