fix(runtime): restart daemon in background
This commit is contained in:
@@ -103,10 +103,11 @@ from the build tree:
|
|||||||
./strans map
|
./strans map
|
||||||
```
|
```
|
||||||
|
|
||||||
`run.sh` stays in the foreground and replaces itself with the daemon. Stop it
|
`run.sh` stops every same-user process whose exact name is `strans`, starts one
|
||||||
with `Ctrl-C` or let a service supervisor own it. It neither finds nor kills
|
build-tree daemon in the background, and returns to the shell. It requires
|
||||||
other `strans` processes. Endpoint collisions and requested frontend startup
|
`pkill` from procps. Startup and frontend failures remain visible on the
|
||||||
failures make the process exit non-zero.
|
caller's standard error. A service supervisor should instead run
|
||||||
|
`./strans map` directly in the foreground.
|
||||||
|
|
||||||
The build does not copy or install the daemon or its data. `./strans DIR`
|
The build does not copy or install the daemon or its data. `./strans DIR`
|
||||||
opens `hira.map`, `kata.map`, `telex.map`, `kanji.dict`, `emoji.dict`, and
|
opens `hira.map`, `kata.map`, `telex.map`, `kanji.dict`, `emoji.dict`, and
|
||||||
|
|||||||
12
run.sh
12
run.sh
@@ -11,4 +11,14 @@ if ! test -x ./strans; then
|
|||||||
echo "run.sh: ./strans is not executable; run make first" >&2
|
echo "run.sh: ./strans is not executable; run make first" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
exec ./strans map
|
if ! command -v pkill >/dev/null 2>&1; then
|
||||||
|
echo "run.sh: pkill is required" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
uid=$(id -u) || exit 1
|
||||||
|
pkill -TERM -u "$uid" -x strans 2>/dev/null || :
|
||||||
|
sleep 0.1
|
||||||
|
pkill -KILL -u "$uid" -x strans 2>/dev/null || :
|
||||||
|
|
||||||
|
./strans map </dev/null &
|
||||||
|
|||||||
Reference in New Issue
Block a user