48 lines
1.3 KiB
Text
48 lines
1.3 KiB
Text
#!/sbin/openrc-run
|
|
|
|
description="Uptime Kuma self-hosted monitoring tool"
|
|
|
|
# Change $directory to path to uptime-kuma
|
|
directory=${directory:-/usr/share/webapps/uptime-kuma}
|
|
pidfile=${pidfile:-/run/$RC_SVCNAME.pid}
|
|
DATA_DIR=${DATA_DIR:-/var/lib/uptime-kuma}
|
|
|
|
log_dir="/var/log/$RC_SVCNAME"
|
|
logfile=${logfile:-$log_dir/$RC_SVCNAME.log}
|
|
output_log="${output_log:-$logfile}"
|
|
error_log="${error_log:-$logfile}"
|
|
|
|
command=${command:-/usr/bin/node}
|
|
command_args="$directory/server/server.js"
|
|
command_user=${command_user:-uptime-kuma:uptime-kuma}
|
|
command_background=true
|
|
|
|
depend() {
|
|
need net
|
|
}
|
|
|
|
start_pre() {
|
|
checkpath --owner=$command_user --directory $log_dir \
|
|
$DATA_DIR \
|
|
$DATA_DIR/upload
|
|
checkpath --owner=$command_user --file $logfile \
|
|
$DATA_DIR/error.log
|
|
|
|
[ ! -e $DATA_DIR/kuma.db ] &&
|
|
cp $directory/db/kuma.db $DATA_DIR
|
|
|
|
checkpath --owner=$command_user --mode 600 --file $DATA_DIR/kuma.db*
|
|
|
|
cd $directory
|
|
|
|
export DATA_DIR UPTIME_KUMA_HOST UPTIME_KUMA_PORT UPTIME_KUMA_SSL_KEY \
|
|
UPTIME_KUMA_SSL_CERT UPTIME_KUMA_SSL_KEY_PASSPHRASE \
|
|
UPTIME_KUMA_CLOUDFLARED_TOKEN UPTIME_KUMA_DISABLE_FRAME_SAMEORIGIN \
|
|
UPTIME_KUMA_WS_ORIGIN_CHECK UPTIME_KUMA_ALLOW_ALL_CHROME_EXEC \
|
|
NODE_EXTRA_CA_CERTS NODE_TLS_REJECT_UNAUTHORIZED NODE_OPTIONS
|
|
}
|
|
|
|
start_post() {
|
|
# Wait for the server to be started
|
|
sleep 10
|
|
}
|