Run script at boot Ubuntu [closed]

asked 2014-10-28 12:35:41 -0500

Jesus gravatar image

Hello guys,

I am pretty new doing script in Ubuntu, I have an application in C++ which uses opencv for Ipcamera video processing, I am working in Ubuntu 14.0.4.

I am going to try to explain what I did:

  • First I wanted to check if a script could be called in the boot, so I created this simple script which only create a file in the same directory in which I have my script:
#!/bin/sh


RUTA_ENTORNO=`dirname $0`

echo "Creando archivo de prueba..."
touch ${RUTA_ENTORNO}/ArchivoPrueba.txt
exit 0

I add into the rc.local the next line:

sh /home/myScript

And when I reboot my computer the file it was created, so perfect.

Then I compiled my application, and I move the executable in the same folder of my Script, and I add this:

#!/bin/sh

/home/executable
RUTA_ENTORNO=`dirname $0`

echo "Creando archivo de prueba..."
touch ${RUTA_ENTORNO}/ArchivoPrueba.txt
exit 0

I added the "/home/executable" line in my Script for executed it, and for check if after this the file.txt it is created.

But here is what I do not undestand, when I reboot my system the camera is not running, it seems that the aplication is not throw, but the file.txt is created, however if in the terminal I type this "sh /home/myScript" the aplication start and I can see the camera, but the file.txt is not created.

How can I run my aplication in automatic way when I reboot my system?

Many thanks

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant by FooBar
close date 2014-10-28 13:09:10.730767

Comments

This is no question about OpenCV so you'll probably get a better answer if you ask it in a ubuntu-forum

FooBar gravatar imageFooBar ( 2014-10-28 12:53:31 -0500 )edit