How to run shell script after boot

Customer would like to run shell script after WP76 module boot.

Customer put as following code in the /etc/init.d/legatostart.sh. Then, WP76 module can run shell script automatically. But customer saw that WP76 module sometimes delete their application after modifying legatstart.sh file.

Please advise how to run shell script after module boot.

umount /legato 2>/dev/null
mount -o bind $LEGATO_MNT /legato
test -x $LEGATO_START && $LEGATO_START

sh /home/root/test1.sh & // customer shell
;;

Does it solve if you add a sleep(5) in beginning of /home/root/test1.sh ?

Another method is to run an unsandboxed helloworld application and call your /home/root/test1.sh by system() API.

After modification for “sleep 5”, customer is working 3 times. But WP76xx module delete application at 4 th boot-up everytime.

Please let us know how to call shell script from API? If possible, please prepare sample adef and c code.

It is probably because you did not type “update -g” after installing the new app.

For sample legato app, you can see

Customer type “update -g” after installing the new application.

Their application is working 5 times from 3 times. But WP76xx module delete these application at 6th boot-up everytime.

Customer will check sample app later, if you have any comment, please advise it.

seems your application is making system unstable, and there is rollback mechanism if there is too much reset

Customer application will use only WP76xx module w/o external Host CPU.
If WP76xx module cannot connect USB interface, WP76xx module went to sleep mode and did not work their application.
So, I received attached wakeup_app from SWI. But customer said that WP76xx module sometimes remove this wakeup_app.
Please check this application is making system unstable. If this application is making system unstable, please let us know how to run their application w/o Host USB interface connection.
wakeup_app.rar (199.2 KB)

Can you attach the uart console to show this problem?

Btw, are you trying on mangoh board?

Please see attached console log.
Teraterm.log: Run customer application and wakeup_app
Teraterm2.log: Run only wakeup_app
Procedure

  1. Add wakeup_app and customer application
  2. send “update –g” command
  3. Power OFF → ON at 5 times
    Please see last line. It is described as “’wakeup_app’ is not installed”.
    Note: Yes, customer is checking this issue using mangOH green board.
    teraterm.log (108.1 KB)
    teraterm2.log (101.9 KB)

Why does the module keep resetting?
If it reboots too much, it will regard as unstable environment and rollback to previous image.


Open I2C Bus at, '/dev/i2c/4'
Try open I2C Bus at, '/dev/i2c-4'
Open I2C Bus at, '/dev/i2c/4'
Try open I2C Bus at, '/dev/i2c-4'
	Register Addr 0x11: 0x1b...

Format: Log Type - Time(microsec) - Message - Optional Info
Log Type: B - Since Boot(Power On Reset),  D - Delta,  S - Statistic
S - QC_IMAGE_VERSION_STRING=BOOT.BF.3.1.2-00094

Thanks. To check it, customer added the following power off code.
system("/sbin/poweroff -f");

But Customer think that WP76xx module do not go to power off sequence.
When customer send “/sbin/poweroff –f” command in linux console, WP76xx module go to power off sequence.
Is there any limitation to perform “system("/sbin/poweroff -f");” command in application?

how about send AT!POWERDOWN to /dev/ttyAT channel

To send AT command, I tried to open /dev/ttyAT channel but I cannot open it from application.
Of course, I succeeded to send AT command from consol window for WP76xx module using microcosm application.

Please advise how to send AT command in application.

you can see this document on how to send AT command in unsandboxed legato application:

Sending AT command in Legato application.docx (215.2 KB)

Thanks.

Customer did not see application deleting issue after adding power down sequence.

But there is possibility that end user will cut power supply in their system without power down sequence. If module delete their application, it is impact for their system.

After deleting their application, SWI default application is still keeping in WP76 module. Can customer set their application as default application?

you can see here on modifying the wifi.sdef to add your application as default application in legato.cwe:

This meaning is that customer need to build “Build your custom Device Image” in https://source.sierrawireless.com/resources/airprime/software/wp76xx/wp76xx-firmware-release-13,-d-,1-components/?

Yes, you are correct