Adding scripts to run at startup

I am just starting with a device from Sierra Wireless (FX-30) running the Legato Linux distribution.

We have not started developing any applications yet but I am just trying to test posting some data to the internet every minute. This is done with a shell script I wrote using curl and a while loop.

By default this script cannot make connections to the internet, it is blocked by the firewall. In order to bypass this another script with the below command is ran

iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

Now that my script can start and post data to the internet I wanted to run it in the background and have it start at boot. I wrote another script to

Hi jakebjorkekato,
You have told that you had problem connecting to the internet as it was blocked by firewall and you were able to access after running the iptables rules you have mentioned.

But we are not clear what actually you are looking for !? Your last sentence I wrote another script to looks incomplete, Have you missed out to provide any information by mistake here ?

Regards,
Muralidhara N.

Hi,

Do you mean you want to add some command in the init script?
Probably you can modify /etc/init.d/mount_early

Hi jyijyi, I too am trying to run a script on boot and was wondering how precisely init.d/mount_early can be modified in order to execute the script. I appreciate your help!

How about adding your script like below in /etc/init.d/mount_early:


Execution starts here.

case “$1” in
start)
mount_early_start

    #try to add your script here

Hi JyiJyi,

I appreciate your previous reply to my post, but I attempted to make the changes that you recommended and am still unable to launch the script on boot. I have included a screenshot of several simple shell commands that I entered into “mount_early” that I could execute normally, but were unable to run in mount_early. Thank you again for your help.

I just tried on WP76 R9, I found that modifying mount_early is not working.
Instead I modify /etc/init.d/startlegato.sh, and I can add my command there.


case “$1” in
start)
echo “Legato start sequence 123”

echo 123 > /tmp/123.txt


You can have a try there.

3 Likes

Thanks jyijyi! That worked. I really appreciate your help.

Hi all,

I was trying to do the same recently with a WP7608 module and run into the same issue:

I created an bash script, stored it at /etc/init.d/ and created a simlink into rcS.d folder with S99 runtime order. The script has execution permissions (chmod +x) but still it is not executed during modem bring up.

Did you find a solution to this other than embedding the code into another existing script?

br
Luis

Hi all,

I have the same problem. Working with WP77xx
Trying to get a program running on startup with init.d. Am I missing some kind of Linux/Yocto configuration that does not allow easily to add startup scripts?

Best,

Jaan

Update:
Or does this post apply? Start up scripts not working - #2 by zabaulkhan
Thus in order to add init.d startup script, I have to rebuild Linux!?