mirror of
https://gitlab.univ-nantes.fr/glicid-public/guix-glicid.git
synced 2025-04-30 14:18:38 +02:00
adding a rc-local like service
This commit is contained in:
parent
eddb3a38ab
commit
9945fdad37
1 changed files with 65 additions and 0 deletions
65
glicid/services/rc-local.scm
Normal file
65
glicid/services/rc-local.scm
Normal file
|
@ -0,0 +1,65 @@
|
|||
(define-module (glicid services rc-local)
|
||||
#:use-module (gnu services)
|
||||
#:use-module (gnu services shepherd)
|
||||
#:use-module (guix)
|
||||
#:use-module (guix records)
|
||||
#:use-module (ice-9 match)
|
||||
#:use-module (gnu packages bash)
|
||||
#:export (
|
||||
%default-rc-local-conf
|
||||
rc-local-configuration
|
||||
rc-local-configuration?
|
||||
rc-local-service
|
||||
rc-local-service-type
|
||||
)
|
||||
)
|
||||
|
||||
(define %default-rc-local-conf
|
||||
(plain-file "rc-local" "
|
||||
# Empty file as we do nothing by default
|
||||
")
|
||||
)
|
||||
|
||||
(define-record-type* <rc-local-configuration>
|
||||
rc-local-configuration make-rc-local-configuration
|
||||
rc-local-configuration?
|
||||
(config-file rc-local-configuration-config-file ; string
|
||||
(default %default-slapd.conf)
|
||||
)
|
||||
)
|
||||
|
||||
(define rc-local-service
|
||||
(match-lambda
|
||||
(($ <rc-local-configuration> rc-local arguments logflags log-file pid-file config-file schema-dir)
|
||||
(list
|
||||
(shepherd-service
|
||||
(provision '(rc-local) )
|
||||
(documentation "Run rc-local.")
|
||||
(requirement '(user-processes))
|
||||
(respawn? #f)
|
||||
(start #~(make-forkexec-constructor
|
||||
(list
|
||||
#$(file-append bash "/bin/bash")
|
||||
#$config-file
|
||||
)
|
||||
))
|
||||
(stop #~(make-kill-destructor))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(define rc-local-service-type
|
||||
(service-type (name 'rc-local)
|
||||
(extensions
|
||||
(list (
|
||||
service-extension
|
||||
shepherd-root-service-type
|
||||
rc-local-service
|
||||
))
|
||||
)
|
||||
(description "Run a script in a rc-local like form")
|
||||
)
|
||||
)
|
||||
|
Loading…
Add table
Reference in a new issue