Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4849

Restarting HAProxy systemd service from bash gives wrong return code

$
0
0

@Cyberfusion wrote:

I have a few HAProxy installs and some scripts to automate stuff.

When I restart HAProxy manually, everything is ok:

root@hapxtest:~# systemctl restart haproxy
root@hapxtest:~# echo $?
0

However, when I execute the same command from either bash, I get return code 2:

haproxy -c -V -f $HAPROXYCONFIG

if [ $? -eq 0 ]; then
    echo Reloading HAProxy

    systemctl restart haproxy

# TODO: For some reason we always get rc 2
#        if [ $? -eq 0 ]; then
#            echo SOS: Something went wrong while reloading HAProxy
#            exit 2
#        fi

I really cannot figure out why. Any idea?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4849

Trending Articles