Good place to put a boot time script for SONiC?

151 views
Skip to first unread message

Justin Hannah

unread,
May 11, 2021, 3:53:00 PM5/11/21
to sonicproject
Someone please have mercy on my soul... I've been trying a lot of different things to put a boot up script for SONiC broadcom accton/edgecore to remove tx_disable at boot time because otherwise the switch will not transmit on any optical ports and I can not get into it remotely on a reboot then which is really bad.

Some suggestions were:
1) add scripts in sonic-buildimage/files/image_config/config-setup/
Does not seem appropriate for running a script at boot time.

2) add scripts in other directory & modify files/build_templates/organization_extensions.sh
I tried this but it runs when building sonic, not when sonic boots on the switch itself.

3) modify accton_as7312_util.py source code to change it
I'm not a python programmer and I would rather just call the script from a bash script as a hack for now.

I am trying to run this bash code on boot:

for x in {1..48}; do accton_as7312_util.py set sfp $x 0; done

Anyone have a suggestion where I can put this in sonic-build or on the running system to persist across reboots?

Thanks!

Yin, Jeff

unread,
May 12, 2021, 2:01:22 PM5/12/21
to Justin Hannah, sonicproject

Could you modify the platform monitor service file (source example: https://github.com/Azure/sonic-buildimage/blob/master/platform/broadcom/sonic-platform-modules-accton/as7312-54x/service/as7312-platform-monitor.service) to include your command?

 

On the system, you can find the location of the file using the `systemctl status <your-service-name>.service` command.

 

HTH,

Jeff

 

From: sonicp...@googlegroups.com <sonicp...@googlegroups.com> On Behalf Of Justin Hannah
Sent: Tuesday, May 11, 2021 12:53
To: sonicproject
Subject: [SONiC] Good place to put a boot time script for SONiC?

 

[EXTERNAL EMAIL]

--
You received this message because you are subscribed to the Google Groups "sonicproject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonicproject...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonicproject/48c62b6f-8906-42bb-ad05-1a5b7ef67260n%40googlegroups.com [groups.google.com].

Justin Hannah

unread,
May 12, 2021, 11:48:00 PM5/12/21
to sonicproject
Oh perfect, thank you so much!  I used ExecStartPost= to run a script to do this after it starts up the monitoring.
Reply all
Reply to author
Forward
0 new messages