mirror of https://github.com/jumpserver/jumpserver
ibuler
3 months ago
committed by
Bryan
1 changed files with 22 additions and 8 deletions
@ -1,12 +1,26 @@ |
|||||||
#!/bin/bash |
#!/bin/bash |
||||||
# |
|
||||||
|
|
||||||
rm -f /opt/jumpserver/tmp/*.pid |
# 不能删掉 cleanup 会产生僵尸进程 |
||||||
|
function cleanup() |
||||||
|
{ |
||||||
|
local pids=`jobs -p` |
||||||
|
if [[ "${pids}" != "" ]]; then |
||||||
|
kill ${pids} >/dev/null 2>/dev/null |
||||||
|
fi |
||||||
|
} |
||||||
|
|
||||||
|
action="${1-start}" |
||||||
|
service="${2-all}" |
||||||
|
|
||||||
case "$1" in |
trap cleanup EXIT |
||||||
start|init_db|upgrade_db) |
|
||||||
set -- /opt/jumpserver/jms "$@" |
rm -f /opt/jumpserver/tmp/*.pid |
||||||
;; |
|
||||||
esac |
|
||||||
|
|
||||||
exec "$@" |
if [[ "$action" == "bash" || "$action" == "sh" ]];then |
||||||
|
bash |
||||||
|
elif [[ "$action" == "sleep" ]];then |
||||||
|
echo "Sleep 365 days" |
||||||
|
sleep 365d |
||||||
|
else |
||||||
|
python jms "${action}" "${service}" |
||||||
|
fi |
||||||
|
Loading…
Reference in new issue