sed append work around
This commit is contained in:
@@ -392,11 +392,11 @@ write_camera() {
|
||||
sed -i "/use_backend $INSTANCE if/a\ use_backend cam${INUM}_$INSTANCE if { path_beg /cam${INUM}_$INSTANCE/ }" /etc/haproxy/haproxy.cfg
|
||||
if [ $HAversion -gt 1 ]; then
|
||||
EXTRACAM="backend cam${INUM}_$INSTANCE\n\
|
||||
http-request replace-path /cam${INUM}_$INSTANCE/(.*) /\1 \n\
|
||||
http-request replace-path /cam${INUM}_$INSTANCE/(.*) /|\1 \n\
|
||||
server webcam1 127.0.0.1:$CAMPORT"
|
||||
else
|
||||
EXTRACAM="backend cam${INUM}_$INSTANCE\n\
|
||||
reqrep ^([^\ :]*)\ /cam${INUM}_$INSTANCE/(.*) \1\ /\2 \n\
|
||||
reqrep ^([^\ :]*)\ /cam${INUM}_$INSTANCE/(.*) \1\ /|\2 \n\
|
||||
server webcam1 127.0.0.1:$CAMPORT"
|
||||
fi
|
||||
|
||||
@@ -404,7 +404,10 @@ EXTRACAM="backend cam${INUM}_$INSTANCE\n\
|
||||
if [ -z "$INUM" ]; then
|
||||
echo "#cam_$INSTANCE start" >> /etc/haproxy/haproxy.cfg
|
||||
fi
|
||||
sed -i "\|#cam${INUM}_$INSTANCE start|a $EXTRACAM" /etc/haproxy/haproxy.cfg
|
||||
sed -i "/#cam${INUM}_$INSTANCE start/a $EXTRACAM" /etc/haproxy/haproxy.cfg
|
||||
#these are necessary because sed append seems to have issues with escaping for the /\1
|
||||
sed -i 's/\/|1/\/\\1/' /etc/haproxy/haproxy.cfg
|
||||
sed -i 's/\/|2/\/\\2/' /etc/haproxy/haproxy.cfg
|
||||
if [ -z "$INUM" ]; then
|
||||
echo "#cam_$INSTANCE stop" >> /etc/haproxy/haproxy.cfg
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user