There are many ways to do this, but on Intel Edison I found that the easiest way is using the /etc/init.d directory.
Create a file in
/etc/init.d
cd /etc/init.d
vi automateSketch.sh
file content
#!/bin/sh
exec /sketch/sketch.elf /dev/ttyGS0 /dev/ttyGS0
give permissions to the file
chmod +x /etc/init.d/automateSketch.sh
Now, to make sure this script is executed every time linux boots, issue the following command and wait for the return shown below
start at boot
update-rc.d automateSketch.sh defaults
References:
https://www.codeproject.com/Articles/1072838/Procedure-to-Autostart-the-Arduino-Sketch-on-Ediso