Recently Written · git

tmpl

Insanely simple templates

git clone https://github.com/equwal/tmpl

Log | Files | Refs


openrc.init (760 bytes)

1 #!/sbin/openrc-run
2 # OpenRC service script
3 
4 command="<++>" # absolute path
5 command_args="<++>" # pid file, run as daemon
6 
7 # command_background="yes" # if you can't run as daemon natively
8 # pidfile="/run/$RC_SVCNAME.pid" # if you can get one from the command/want to be able to stop it with pid signals
9 
10 depend() {
11 	# add as required
12 	need <++>
13 	#want <++>
14 	#use <++>
15 	#provide <++>
16 	# will start immediately before/after something else (prevents parallelisation)
17 	#before <++>
18 	#after <++>
19 }
20 
21 start() {
22 	ebegin "Starting <++>"
23 	# --ionice 2:7 --nicelevel 12 # example nice levels
24 	start-stop-daemon \
25 		--start \
26 		--name <++> \
27 		--exec "$command" \
28 		-- $command_args
29 	eend $?
30 }
31 
32 stop() {
33 	start-stop-daemon --stop --quiet --pidfile "/run/$RC_SVCNAME.pid"
34 }