2 Replies Latest reply on Aug 18, 2015 4:09 PM by dpc27

    Problem setting sh script at startup





      I have running a node webserver on Intel Galileo Gen 1 and a normal arduino sketch which saves data from UDP messages.


      I've tried to use the call system to set the timezone, date and start the webserver, but doesn't work very well. Then I created a sh script with the same commands, and created the corresponding links to the file in "/etc/init.d" using "update-rc.d startServer.sh defaults".


      system("export TZ=CET-1CEST,M3.5.0,M10.5.0/3");    

      system("rdate && hwclock --systohc");

      system("node /media/mmcb1k0p1/Server/server2.js"); 


      It works, but Galileo does not start ssh, since I cannot connect anymore if it's running + sometimes the arduino sketch is not running. It seems like Galileo is currently executing the webserver and waits for it to finish to execute the rest, like an active process.


      Any help?

        • 1. Re: Problem setting sh script at startup



          Are you running these commands in the void setup or the void loop part of your program? What happens if you run those commands directly? Do you mind posting your Arduino sketch?



          • 2. Re: Problem setting sh script at startup

            Hi again,


            It was in the setup function, but never mind, I've solved the problem.


            The system calls doesn't work well, sometimes they do, sometimes part of it, etc, but using the sh script it does work perfectly.

            To send the server to the background I added the character "&" at the end of the command.

            The script would be like this:


            export TZ=CET-1CEST,M3.5.0,M10.5.0/3

            rdate && hwclock --systohc

            node /media/mmcb1k0p1/Server/server2.js &