service creator added
This commit is contained in:
+42
-1
@@ -4,11 +4,13 @@
|
||||
racket/contract
|
||||
racket/format
|
||||
racket/string
|
||||
racket/os
|
||||
simple-log
|
||||
"private-player-agent/player-agent-config.rkt"
|
||||
"private-player-agent/player-agent-core.rkt")
|
||||
|
||||
(provide run-player-agent-cli)
|
||||
(provide run-player-agent-cli
|
||||
create-player-agent-service-file)
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Supporting functions
|
||||
@@ -125,6 +127,45 @@
|
||||
(kill-thread monitor))
|
||||
((player-agent-runtime-shutdown! runtime))))))
|
||||
|
||||
|
||||
|
||||
|
||||
(define (create-player-agent-service-file url filename)
|
||||
(let ((fh (open-output-file filename #:exists? 'replace)))
|
||||
(for-each (lambda (l)
|
||||
(displayln l out))
|
||||
(list
|
||||
"[Unit]"
|
||||
"Description=Racket Web Player Agent"
|
||||
"After=network.target"
|
||||
""
|
||||
"[Service]"
|
||||
"Type=simple"
|
||||
"User=root"
|
||||
"Group=root"
|
||||
""
|
||||
"WorkingDirectory=/tmp"
|
||||
""
|
||||
(string-append
|
||||
"ExecStart=/usr/local/bin/racket "
|
||||
"-e "
|
||||
"\"(require rkt-web-player/player-agent-cli) "
|
||||
"(run-player-agent-cli #:server-url \\\"" url "\\\" #:name " (gethostname) ")\""
|
||||
)
|
||||
""
|
||||
"Restart=on-failure"
|
||||
"RestartSec=5"
|
||||
""
|
||||
"TimeoutStopSec=30"
|
||||
""
|
||||
"[Install]"
|
||||
"WantedBy=multi-user.target"
|
||||
)
|
||||
)
|
||||
(close-output-port fh)))
|
||||
|
||||
|
||||
|
||||
(module+ main
|
||||
(define server-url #f)
|
||||
(define name #f)
|
||||
|
||||
Reference in New Issue
Block a user