25 lines
547 B
Plaintext
25 lines
547 B
Plaintext
#!/sbin/openrc-run
|
|
name=${RC_SVCNAME}
|
|
source /etc/conf.d/${name}
|
|
cmd="/usr/bin/cloudflared --pidfile /var/run/${name}.pid --autoupdate-freq 24h0m0s tunnel run --token $CLOUDFLARED_TUNNEL_TOKEN"
|
|
pid_file="/var/run/${name}.pid"
|
|
stdout_log="/var/log/$name.log"
|
|
stderr_log="/var/log/$name.err"
|
|
command_background="yes"
|
|
|
|
depend() {
|
|
need net
|
|
need gitea
|
|
}
|
|
|
|
start() {
|
|
$cmd >> "$stdout_log" 2>> "$stderr_log" &
|
|
echo $! > "$pid_file"
|
|
}
|
|
stop() {
|
|
if [ -f "$pid_file" ]; then
|
|
kill $(cat "$pid_file")
|
|
rm -f "$pid_file"
|
|
fi
|
|
}
|