1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00
ContextOS/bin/ice.sh
2022-02-14 12:21:41 +08:00

24 lines
492 B
Bash
Executable File

#!/bin/sh
export ctx_log=${ctx_log:=bin/boot.log}
export ctx_pid=${ctx_pid:=var/run/ice.pid}
start() {
trap HUP hup && while true; do
date && bin/ice.bin $@ 2>$ctx_log && break || echo -e \"\n\nrestarting...\"
sleep 1
done
}
restart() {
[ -e $ctx_pid ] && kill -2 `cat $ctx_pid` &>/dev/null || echo
}
stop() {
[ -e $ctx_pid ] && kill -3 `cat $ctx_pid` &>/dev/null || echo
}
serve() {
stop && start $@
}
cmd=$1 && [ -n \"$cmd\" ] && shift || cmd=serve
$cmd $*