Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Cannot run a script that executes my opencv program at startup under Linux

Hi there,

I would need some help there.

I'm trying (since this morning) to make a script that can launch my opencv program at startup. The script does work well :

#!/bin/sh

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/lemaker/Documents/Project/opencv/install/lib

/home/lemaker/Documents/Project/opencv_program

As you can see (or not), I work on a LeMaker Guitar using Ubuntu Mate.

I explored many solutions :

  • Launching my script from /etc/rc.local
  • Launching my script as a Linux service
  • Launching my script with crontab -e
  • Launching my script after X started (in /etc/X11/xinit/xinitrc)

It does just not work. When, in my script, I put some basic commands like creating a file or something, it works. But when I try to launch my program, only its line does not work. I have to export a library path because I compiled opencv as shared libs.

I tried to do it with sudo :

#!/bin/sh

sudo -s <<EOF

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/lemaker/Documents/Project/opencv/install/lib

/home/lemaker/Documents/Project/opencv_program

EOF

This does not work too. I suspect that I have to launch my program with specific requirements but I can't find out which ones. Do I need to run my script after X started, or something ? Do you guys have any experience in launching an opencv program at startup ?

Could you please guide me ?

Thank you in advance, and have a good day !

Cannot run a script that executes my opencv program at startup under Linux

Hi there,

I would need some help there.

I'm trying (since this morning) to make a script that can launch my opencv program at startup. The script does work well :

#!/bin/sh

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/lemaker/Documents/Project/opencv/install/lib

/home/lemaker/Documents/Project/opencv_program

As you can see (or not), I work on a LeMaker Guitar using Ubuntu Mate.

EDIT: The thing is, the opencv_program doesnt start at startup, trying to check if it had started using htop or top. In fact, I don't even know if my script is ok, I mean : I don't have any mean to check any debug messages or something.

I explored many solutions :

  • Launching my script from /etc/rc.local
  • Launching my script as a Linux service
  • Launching my script with crontab -e
  • Launching my script after X started (in /etc/X11/xinit/xinitrc)

It does just not work. When, in my script, I put some basic commands like creating a file or something, it works. But when I try to launch my program, only its line does not work. I have to export a library path because I compiled opencv as shared libs.

I tried to do it with sudo :

#!/bin/sh

sudo -s <<EOF

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/lemaker/Documents/Project/opencv/install/lib

/home/lemaker/Documents/Project/opencv_program

EOF

This does not work too. I suspect that I have to launch my program with specific requirements but I can't find out which ones. Do I need to run my script after X started, or something ? Do you guys have any experience in launching an opencv program at startup ?

Could you please guide me ?

Thank you in advance, and have a good day !