> Subject: Re: How can i get haproxy reload its configuration
> From: Vincent Bernat 
> Date: 2015-03-24 12:07:34
> Message-ID: 87619q61kp.fsf () zoro ! exoscale ! ch

> ❦ 24 mars 2015 07:45 -0400, jeff saremi  :

> > #!/bin/sh
> > pidfile=/data/haproxy.pidhaproxy -db \
> > -f /haproxy-1.5.8/haproxy.cfg -p $pidfile \
> > -sf $(cat $pidfile)

> The shell does variable substitution first, then execute the
> line. Hence, $pidfile is expanded to "", not to "/data/haproxy.pid". Put
> pidfile=... on its own line.
> -- 
> I'll burn my books.
> -- Christopher Marlowe


Sorry that was just how my email got through. Those are separate lines.
So here it is again:
#!/bin/sh
pidfile=/data/haproxy.pid
haproxy -db \
    -f /haproxy-1.5.8/haproxy.cfg -p $pidfile \
    -sf $(cat $pidfile)

What i'm wondering is how this could have ever worked? since the "$(cat 
$pidfile) and the creation of the $pidfile are both on the same line. Is it 
possible that when the pidfile is concatenated for the sake of "-sf" the file 
does not exist or contains old pids?

                                          

Reply via email to