more test and vagrant for nginx checks
This commit is contained in:
parent
4f5b0178cc
commit
f69daf773e
5 changed files with 38 additions and 27 deletions
|
|
@ -161,7 +161,11 @@ pidfile_zapold(pid_t pid)
|
||||||
clicon_log(LOG_NOTICE, "Killing old daemon with pid: %d", pid);
|
clicon_log(LOG_NOTICE, "Killing old daemon with pid: %d", pid);
|
||||||
killpg(pid, SIGTERM);
|
killpg(pid, SIGTERM);
|
||||||
kill(pid, SIGTERM);
|
kill(pid, SIGTERM);
|
||||||
sleep(1); /* check again */
|
/* Need to sleep process properly and then check again */
|
||||||
|
if (usleep(100000) < 0){
|
||||||
|
clicon_err(OE_UNIX, errno, "usleep");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
if ((kill (pid, 0)) != 0 && errno == ESRCH) /* Nothing there */
|
if ((kill (pid, 0)) != 0 && errno == ESRCH) /* Nothing there */
|
||||||
;
|
;
|
||||||
else{ /* problem: couldnt kill it */
|
else{ /* problem: couldnt kill it */
|
||||||
|
|
|
||||||
43
test/lib.sh
43
test/lib.sh
|
|
@ -41,26 +41,29 @@ if [ -f ./config.sh ]; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
: ${SKIPLIST:=false}
|
||||||
# Sanity nginx running on systemd platforms
|
# Sanity nginx running on systemd platforms
|
||||||
if systemctl > /dev/null 2>&1 ; then
|
if $NGINXCHECK; then
|
||||||
# even if systemd exists, nginx may be started in other ways
|
if systemctl > /dev/null 2>&1 ; then
|
||||||
nginxactive=$(systemctl show nginx |grep ActiveState=active)
|
# even if systemd exists, nginx may be started in other ways
|
||||||
if [ "${WITH_RESTCONF}" = "fcgi" ]; then
|
nginxactive=$(systemctl show nginx |grep ActiveState=active)
|
||||||
if [ -z "$nginxactive" -a ! -f /var/run/nginx.pid ]; then
|
if [ "${WITH_RESTCONF}" = "fcgi" ]; then
|
||||||
echo -e "\e[31m\nwith-restconf=fcgi set but nginx not running, start with:"
|
if [ -z "$nginxactive" -a ! -f /var/run/nginx.pid ]; then
|
||||||
echo "systemctl start nginx"
|
echo -e "\e[31m\nwith-restconf=fcgi set but nginx not running, start with:"
|
||||||
echo -e "\e[0m"
|
echo "systemctl start nginx"
|
||||||
exit -1
|
echo -e "\e[0m"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ -n "$nginxactive" -o -f /var/run/nginx.pid ]; then
|
||||||
|
echo -e "\e[31m\nwith-restconf=fcgi not set but nginx running, stop with:"
|
||||||
|
echo "systemctl stop nginx"
|
||||||
|
echo -e "\e[0m"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
fi # systemctl
|
||||||
if [ -n "$nginxactive" -o -f /var/run/nginx.pid ]; then
|
fi
|
||||||
echo -e "\e[31m\nwith-restconf=fcgi not set but nginx running, stop with:"
|
|
||||||
echo "systemctl stop nginx"
|
|
||||||
echo -e "\e[0m"
|
|
||||||
exit -1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi # systemctl
|
|
||||||
|
|
||||||
# Test number from start
|
# Test number from start
|
||||||
: ${testnr:=0}
|
: ${testnr:=0}
|
||||||
|
|
@ -119,10 +122,10 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Multiplication factor to sleep less than whole seconds
|
# Multiplication factor to sleep less than whole seconds
|
||||||
DEMSLEEP=.5
|
DEMSLEEP=.2
|
||||||
|
|
||||||
# DEMWAIT is expressed in seconds, but really * DEMSLEEP
|
# DEMWAIT is expressed in seconds, but really * DEMSLEEP
|
||||||
let DEMLOOP=2*DEMWAIT
|
let DEMLOOP=5*DEMWAIT
|
||||||
|
|
||||||
# RESTCONF protocol, eg http or https
|
# RESTCONF protocol, eg http or https
|
||||||
: ${RCPROTO:=http}
|
: ${RCPROTO:=http}
|
||||||
|
|
|
||||||
|
|
@ -22,5 +22,9 @@
|
||||||
|
|
||||||
# Some restconf tests can run IPv6, but its complicated because:
|
# Some restconf tests can run IPv6, but its complicated because:
|
||||||
# - docker by default does not run IPv6
|
# - docker by default does not run IPv6
|
||||||
# - for fcgi nginx needs to be configured properly (shouldnt be a problem)
|
|
||||||
#IPv6=false
|
#IPv6=false
|
||||||
|
|
||||||
|
# Check sanity between --with-restconf setting and if nginx is started by systemd or not
|
||||||
|
# This check is optional because some installs, such as vagrant make a non-systemd/direct
|
||||||
|
# start
|
||||||
|
#NGINXCHECK=false
|
||||||
|
|
|
||||||
|
|
@ -164,9 +164,11 @@ if [ $BE -ne 0 ]; then
|
||||||
fi
|
fi
|
||||||
new "start backend -s init -f $cfg"
|
new "start backend -s init -f $cfg"
|
||||||
start_backend -s init -f $cfg
|
start_backend -s init -f $cfg
|
||||||
|
|
||||||
|
new "wait backend"
|
||||||
|
wait_backend
|
||||||
fi
|
fi
|
||||||
new "waiting"
|
|
||||||
wait_backend
|
|
||||||
|
|
||||||
if [ $RC -ne 0 ]; then
|
if [ $RC -ne 0 ]; then
|
||||||
|
|
||||||
|
|
@ -176,7 +178,7 @@ if [ $RC -ne 0 ]; then
|
||||||
new "start restconf daemon"
|
new "start restconf daemon"
|
||||||
start_restconf -f $cfg
|
start_restconf -f $cfg
|
||||||
|
|
||||||
new "waiting"
|
new "wait restconf"
|
||||||
wait_restconf
|
wait_restconf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,8 +84,6 @@ cat<<'EOF' > $dir/startnginx.sh
|
||||||
sudo sh -c ' echo 'nginx_enable="YES"' >> /etc/rc.conf'
|
sudo sh -c ' echo 'nginx_enable="YES"' >> /etc/rc.conf'
|
||||||
fi
|
fi
|
||||||
sudo /usr/local/etc/rc.d/nginx restart
|
sudo /usr/local/etc/rc.d/nginx restart
|
||||||
elif systemctl > /dev/null 2>&1 ; then
|
|
||||||
sudo systemctl start nginx
|
|
||||||
else
|
else
|
||||||
sudo pkill nginx
|
sudo pkill nginx
|
||||||
nginxbin=$(sudo which nginx)
|
nginxbin=$(sudo which nginx)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue