mirror of
https://github.com/idanoo/GoCatFacts
synced 2025-07-01 06:42:14 +00:00
Add sysd service + newline
This commit is contained in:
parent
d39591b3c0
commit
536ac1ec68
2 changed files with 18 additions and 1 deletions
17
gocatfacts.service
Normal file
17
gocatfacts.service
Normal file
|
@ -0,0 +1,17 @@
|
|||
[Unit]
|
||||
Description=GoCatFacts
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/root/GoCatFacts
|
||||
ExecStart=/usr/local/go/bin/go run main.go
|
||||
Environment="GOCACHE=/tmp/gocatfacts"
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
2
main.go
2
main.go
|
@ -28,7 +28,7 @@ func main() {
|
|||
}
|
||||
|
||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
io.WriteString(w, getRandomFact())
|
||||
io.WriteString(w, getRandomFact()+"\n")
|
||||
})
|
||||
err = http.ListenAndServe(":"+port, nil)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue