2018-11-13 07:57:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
function cleanup()
|
|
|
|
{
|
|
|
|
local pids=`jobs -p`
|
2019-02-22 08:14:50 +00:00
|
|
|
if [[ "${pids}" != "" ]]; then
|
|
|
|
kill ${pids} >/dev/null 2>/dev/null
|
2018-11-13 07:57:44 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-12-03 06:01:26 +00:00
|
|
|
action="${1-start}"
|
|
|
|
service="${2-all}"
|
2019-01-19 11:29:38 +00:00
|
|
|
|
2019-02-22 08:33:27 +00:00
|
|
|
trap cleanup EXIT
|
2022-09-15 04:26:04 +00:00
|
|
|
|
|
|
|
rm -f /opt/jumpserver/tmp/*.pid
|
|
|
|
|
2020-12-03 06:01:26 +00:00
|
|
|
if [[ "$action" == "bash" || "$action" == "sh" ]];then
|
2019-02-22 08:14:50 +00:00
|
|
|
bash
|
2021-08-12 09:53:43 +00:00
|
|
|
elif [[ "$action" == "sleep" ]];then
|
|
|
|
echo "Sleep 365 days"
|
|
|
|
sleep 365d
|
2019-02-22 08:33:27 +00:00
|
|
|
else
|
2020-12-03 06:01:26 +00:00
|
|
|
python jms "${action}" "${service}"
|
2019-02-22 08:14:50 +00:00
|
|
|
fi
|
2022-09-21 06:27:09 +00:00
|
|
|
|