26 lines
564 B
Bash
26 lines
564 B
Bash
#!/bin/bash
|
|
|
|
pid=''
|
|
run=true
|
|
|
|
start() {
|
|
@CMAKE_INSTALL_FULL_BINDIR@/@PROJECT_NAME@ \
|
|
--docroot=@CMAKE_INSTALL_FULL_DATADIR@/@PROJECT_NAME@/docroot \
|
|
--http-address 0.0.0.0 --http-port 8080 \
|
|
--config @CMAKE_INSTALL_FULL_SYSCONFDIR@/@PROJECT_NAME@/wt_config.xml \
|
|
--resources-dir /usr/share/Wt/resources &> >(logger --tag @PROJECT_NAME@) & pid="$!"
|
|
}
|
|
|
|
shutdown() {
|
|
run=false
|
|
(( $pid )) && kill "$pid"
|
|
}
|
|
|
|
trap shutdown EXIT
|
|
|
|
start
|
|
while $run
|
|
do
|
|
wait "$pid" || { logger --tag @PROJECT_NAME@ -p 3 "restarting server after error"; start; }
|
|
done
|