forked from Qortal/qortal
Exit from stop.sh with an error if curl isn't installed. Based on code submitted by TRM13 in issue #28.
This commit is contained in:
parent
dc6eda1355
commit
02100c502b
39
stop.sh
39
stop.sh
@ -21,21 +21,32 @@ fi
|
||||
read pid 2>/dev/null <run.pid
|
||||
is_pid_valid=$?
|
||||
|
||||
echo 'Calling GET /admin/stop on local Qortal node'
|
||||
if curl --url http://localhost:12391/admin/stop 1>/dev/null 2>&1; then
|
||||
echo "Qortal node responded and should be shutting down"
|
||||
if [ "${is_pid_valid}" -eq 0 ]; then
|
||||
echo -n "Monitoring for Qortal node to end"
|
||||
while s=`ps -p $pid -o stat=` && [[ "$s" && "$s" != 'Z' ]]; do
|
||||
echo -n .
|
||||
sleep 1
|
||||
done
|
||||
echo
|
||||
echo "${green}Qortal ended gracefully${normal}"
|
||||
rm -f run.pid
|
||||
# Ensure curl is installed
|
||||
curl_path=$(which curl)
|
||||
|
||||
if [[ -f $curl_path ]]; then
|
||||
|
||||
echo 'Calling GET /admin/stop on local Qortal node'
|
||||
if curl --url http://localhost:12391/admin/stop 1>/dev/null 2>&1; then
|
||||
echo "Qortal node responded and should be shutting down"
|
||||
|
||||
if [ "${is_pid_valid}" -eq 0 ]; then
|
||||
echo -n "Monitoring for Qortal node to end"
|
||||
while s=`ps -p $pid -o stat=` && [[ "$s" && "$s" != 'Z' ]]; do
|
||||
echo -n .
|
||||
sleep 1
|
||||
done
|
||||
echo
|
||||
echo "${green}Qortal ended gracefully${normal}"
|
||||
rm -f run.pid
|
||||
fi
|
||||
exit 0
|
||||
else
|
||||
echo "${red}No response from Qortal node - not running?${normal}"
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
|
||||
else
|
||||
echo "${red}No response from Qortal node - not running?${normal}"
|
||||
echo "${red}curl is not installed or in the path${normal}"
|
||||
exit 1
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user