2021-06-22 10:14:25 +00:00
|
|
|
#!/bin/bash -e
|
2020-02-10 08:00:54 +00:00
|
|
|
|
|
|
|
function checkConfigExists() {
|
|
|
|
COUNTER=0
|
2021-06-22 10:14:25 +00:00
|
|
|
while [[ ! -e /home/frappe/frappe-bench/sites/common_site_config.json && ${COUNTER} -le 30 ]]; do
|
|
|
|
((COUNTER = COUNTER + 1))
|
|
|
|
echo "config file not created, retry ${COUNTER}"
|
|
|
|
sleep 1
|
2020-02-10 08:00:54 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
if [[ ! -e /home/frappe/frappe-bench/sites/common_site_config.json ]]; then
|
|
|
|
echo "timeout: config file not created"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-06-22 10:14:25 +00:00
|
|
|
if [[ "$1" == 'start' ]]; then
|
2020-02-10 08:00:54 +00:00
|
|
|
checkConfigExists
|
2021-02-20 10:54:01 +00:00
|
|
|
node /home/frappe/frappe-bench/apps/frappe/socketio.js
|
2020-02-10 08:00:54 +00:00
|
|
|
|
2021-06-22 10:14:25 +00:00
|
|
|
elif [[ "$1" == 'doctor' ]]; then
|
2021-02-20 10:54:01 +00:00
|
|
|
node /home/frappe/frappe-bench/apps/frappe/health.js
|
2020-02-10 08:00:54 +00:00
|
|
|
|
|
|
|
else
|
2021-02-20 10:54:01 +00:00
|
|
|
exec -c "$@"
|
2020-02-10 08:00:54 +00:00
|
|
|
|
|
|
|
fi
|