mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
OpenRC-Script.md: initialize kuma.db
- Initialize `kuma.db` if missing, and fix `$directory/data/kuma.db\*` created during `start_pre()` at first run - Merge log files, and fix `$log_dir/*.log` created during `start_pre()` at first run - Fix typo
parent
c503631423
commit
a8135e8c85
1 changed files with 8 additions and 11 deletions
|
@ -11,8 +11,9 @@ directory=${directory:-/usr/share/uptime-kuma}
|
||||||
pidfile=${pidfile:-/run/$RC_SVCNAME.pid}
|
pidfile=${pidfile:-/run/$RC_SVCNAME.pid}
|
||||||
|
|
||||||
log_dir="/var/log/$RC_SVCNAME"
|
log_dir="/var/log/$RC_SVCNAME"
|
||||||
output_log="${output_log:-$log_dir/output.log}"
|
logfile=${logfile:-$log_dir/$RC_SVCNAME.log}
|
||||||
error_log="${error_log:-$log_dir/error.log}"
|
output_log="${output_log:-$logfile}"
|
||||||
|
error_log="${error_log:-$logfile}"
|
||||||
|
|
||||||
command=${command:-/usr/bin/node}
|
command=${command:-/usr/bin/node}
|
||||||
command_args="$directory/server/server.js"
|
command_args="$directory/server/server.js"
|
||||||
|
@ -27,9 +28,12 @@ start_pre() {
|
||||||
checkpath --owner=$command_user --directory $log_dir \
|
checkpath --owner=$command_user --directory $log_dir \
|
||||||
$directory/data \
|
$directory/data \
|
||||||
$directory/data/upload
|
$directory/data/upload
|
||||||
checkpath --owner=$command_user --file $log_dir/*.log \
|
checkpath --owner=$command_user --file $logfile \
|
||||||
$directory/data/error.log
|
$directory/data/error.log
|
||||||
|
|
||||||
|
[ ! -e $directory/data/kuma.db ] &&
|
||||||
|
cp $directory/db/kuma.db $directory/data/
|
||||||
|
|
||||||
checkpath --owner=$command_user --mode 600 --file $directory/data/kuma.db*
|
checkpath --owner=$command_user --mode 600 --file $directory/data/kuma.db*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,14 +56,7 @@ sudo addgroup -S uptime-kuma
|
||||||
sudo adduser -S -D -h /var/lib/uptime-kuma -s /sbin/nologin -G uptime-kuma -g uptime-kuma uptime-kuma
|
sudo adduser -S -D -h /var/lib/uptime-kuma -s /sbin/nologin -G uptime-kuma -g uptime-kuma uptime-kuma
|
||||||
```
|
```
|
||||||
|
|
||||||
If the database is not initialized, it has to be run fisrt.
|
Start the service and add it to default runlevel if preferred.
|
||||||
|
|
||||||
```sh
|
|
||||||
cd /usr/share/uptime-kuma
|
|
||||||
sudo -u uptime-kuma node server/server.js
|
|
||||||
```
|
|
||||||
|
|
||||||
Start the service and add it to default runlevel if prefered.
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo rc-service uptime-kuma start
|
sudo rc-service uptime-kuma start
|
||||||
|
|
Loading…
Reference in a new issue