2017-11-14 16:40:15 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
rm -f /var/run/rsyslogd.pid
|
|
|
|
|
|
|
|
supervisorctl start rsyslogd
|
|
|
|
|
2018-04-06 21:24:18 -05:00
|
|
|
# Router advertiser should only run on ToR (T0) devices
|
|
|
|
DEVICE_ROLE=$(sonic-cfggen -d -v "DEVICE_METADATA.localhost.type")
|
|
|
|
if [ "$DEVICE_ROLE" != "ToRRouter" ]; then
|
|
|
|
echo "Device role is not ToRRouter. Not starting router advertiser process."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Generate /etc/radvd.conf config file
|
|
|
|
sonic-cfggen -d -t /usr/share/sonic/templates/radvd.conf.j2 > /etc/radvd.conf
|
|
|
|
|
2018-04-24 17:13:51 -05:00
|
|
|
# Enusre at least one interface is specified in radvd.conf
|
|
|
|
NUM_IFACES=$(grep -c "^interface " /etc/radvd.conf)
|
|
|
|
if [ $NUM_IFACES -eq 0 ]; then
|
|
|
|
echo "No interfaces specified in radvd.conf. Not starting router advertiser process."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-03-02 17:45:43 -06:00
|
|
|
# Generate the script that waits for pertinent interfaces to come up and make it executable
|
|
|
|
sonic-cfggen -d -t /usr/share/sonic/templates/wait_for_intf.sh.j2 > /usr/bin/wait_for_intf.sh
|
|
|
|
chmod +x /usr/bin/wait_for_intf.sh
|
|
|
|
|
|
|
|
# Wait for pertinent interfaces to come up
|
|
|
|
/usr/bin/wait_for_intf.sh
|
|
|
|
|
2017-11-14 16:40:15 -06:00
|
|
|
# Start the router advertiser
|
|
|
|
supervisorctl start radvd
|