Make logging base dir configurable

This commit is contained in:
crater2150 2023-08-21 11:34:22 +02:00
parent f9bc7405a9
commit d5fa2e99de
2 changed files with 3 additions and 4 deletions

View file

@ -4,7 +4,7 @@ Various runit service files for per-user services. May need to be modified to wo
Helper scripts:
- `log`: symlink as the `run` script in your service's log directory to enable
logging to `~/.local/log/`
logging to `$SVLOGDIR`. If unset, defaults to `~/.local/log/`
- `utils/setup-supervise.zsh`: run to create symlinks for `supervise`
directories, so they are created in $XDG_RUNTIME_DIR
- `utils/new-service`: create a new service, executing the given command line.
@ -17,6 +17,5 @@ Helper scripts:
```sh
utils/new-service -l my-daemon --foreground -a -b -c
```
- `utils/svlogs`: like svlogtail for user services. Uses $SVLOGDIRS or
`~/.local/log/` as base dir. ZSH completion file available in
- `utils/svlogs`: like svlogtail for user services. ZSH completion file available in
`utils/completions`

2
log
View file

@ -1,5 +1,5 @@
#!/bin/zsh
SERVICE=${0:a:h:h:t}
LOGDIR=$HOME/.local/log/$SERVICE
LOGDIR=${SVLOGDIR:-$HOME/.local/log}/$SERVICE
mkdir -p $LOGDIR
exec svlogd -ttt $LOGDIR