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

    Problem setting sh script at startup

    dpc27

      Hi!

       

       

      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 132.163.4.101 && 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
          Intel_Alvarado

          Hi,

           

          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?

           

          Sergio

          • 2. Re: Problem setting sh script at startup
            dpc27

            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 132.163.4.101 && hwclock --systohc

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