Article 5DA8D Word "reached" inserted in file when run under systemd

Word "reached" inserted in file when run under systemd

by
MQMan
from LinuxQuestions.org on (#5DA8D)
I wasn't really sure how to write a title for this.

I have a systemd service to control a Wireguard client running on my CentOS 7.9 system. As part of the wireguard configuration I run a PostUp script. Starting the service from the command line works perfectly every time. But when it starts as part of system boot, part of the PostUp script fails every time. I added some "echo" statements to the script to see what's going on. Here's the script itself, with the echo's:
Code:#!/bin/bash

echo -e `date` >> /root/wg1
echo -e $0 >> /root/wg1

ESMITH_DIR=/etc/e-smith/templates-custom/etc/shorewall

UK_DEV=$(/bin/host beebon | /bin/awk '{print $NF}')
WG_DNS='192.168.250.1'

# Grab the port that's listening:
PORT=$(/bin/wg show $1 listen-port)
/sbin/e-smith/config set fw_wg1 service status enabled UDPPorts $PORT access red

echo -e "# Masquerade the wireguard tunnel" > $ESMITH_DIR/snat/30wg1
echo -e "MASQUERADE\t-\t$1" >> $ESMITH_DIR/snat/30wg1
echo -e "" >> $ESMITH_DIR/snat/30wg1

echo -e "# Add the wireguard provider mask" > $ESMITH_DIR/providers/40wg1
echo -e "$1\t3\t-\t-\t$1\t-\ttrack,fallback" >> $ESMITH_DIR/providers/40wg1
echo -e "" >> $ESMITH_DIR/providers/40wg1

echo -e "# Force the UK Roku stuff out via the vpn" > $ESMITH_DIR/rtrules/40wg1
echo -e "$UK_DEV\t-\t$1\t1050" >> $ESMITH_DIR/rtrules/40wg1
echo -e "-\t$WG_DNS\t$1\t1050" >> $ESMITH_DIR/rtrules/40wg1
echo -e "" >> $ESMITH_DIR/rtrules/40wg1

echo -e "$(<$ESMITH_DIR/rtrules/40wg1)" >> /root/wg1
echo -e "\n" >> /root/wg1

echo -e "# Redirct the UK Roku DNS via the vpn" > $ESMITH_DIR/rules/65wg1
echo -e "DNAT\tloc:$UK_DEV\twg:$WG_DNS\ttcp,udp\tdomain\t-\t&br0" >> $ESMITH_DIR/rules/65wg1
echo -e "" >> $ESMITH_DIR/rules/65wg1

# Reload the firewall
/sbin/e-smith/signal-event firewall-adjustStarting the service from the command line, produces this, which is exactly what I expect:
Code:Sat Jan 23 17:02:09 PST 2021
/usr/local/bin/UKtunup.sh
# Force the UK Roku stuff out via the vpn
192.168.0.65 - wg1 1050
- 192.168.250.1 wg1 1050But, when the service is started at boot time, it gives this:
Code:Sat Jan 23 16:56:16 PST 2021
/usr/local/bin/UKtunup.sh
# Force the UK Roku stuff out via the vpn
192.168.0.65
reached
reached - wg1 1050
- 192.168.250.1 wg1 1050Does anyone have any idea where the 2 "reached" strings are coming from, and more importantly, how do I stop that happening.

Cheers.latest?d=yIl2AUoC8zA latest?i=gsrVw2kSzNY:skE0sbPRV6c:F7zBnMy latest?i=gsrVw2kSzNY:skE0sbPRV6c:V_sGLiP latest?d=qj6IDK7rITs latest?i=gsrVw2kSzNY:skE0sbPRV6c:gIN9vFwgsrVw2kSzNY
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments