feat: get spawn init script working

This commit is contained in:
Nuno Sempere 2022-04-10 22:19:33 +00:00
parent 649e5dff17
commit 60b179dbac
3 changed files with 28 additions and 16 deletions

4
bin/contrib/hacky-start.rc Executable file
View File

@ -0,0 +1,4 @@
## Either figure out init, or run this every time from a sudo user.
sudo rc-service nginx start
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/fcgiwrap

24
bin/contrib/spawn-fcgi Executable file
View File

@ -0,0 +1,24 @@
#!/sbin/openrc-run
## move to /etc/init.d/spawn-fcgi2
## Then sudo rc-update add spawn-fcgi2
## test with sudo rc-service spawn-fcgi2 start
## and sudo rc-service spawn-fcgi2 stop
PID_file="/var/tmp/spawn"
depend() {
need net
}
start() {
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/fcgiwrap -P "$PID_file"
}
stop() {
kill -15 "$(cat "$PID_file")"
rm "$PID_file"
}
case $1 in
start|stop) "$1" ;;
esac

View File

@ -1,16 +0,0 @@
#!/usr/bin/bash
PID_file="/home/uriel/workspace/werc-1.5.0/bin/pid"
start() {
PID_spawn="$(/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/sbin/fcgiwrap)"
echo "$PID_spawn" > "$PID_file"
}
stop() {
kill -15 "$(cat "$PID_file")"
}
case $1 in
start|stop) "$1" ;;
esac