The init.d script is installed properly and by me i wrote the script correctly. But i have a very strange situation. The script executes a multi-threaded program written in c++ by me. If i execute the program through terminal (i installed in /usr/sbin/) like: "MyProgram &" everything is ok. But if this program is executed by the init.d script one thread fails. The other threads of the program as the other features of the init.d script specifications works as expected to. I also have to mention that the thread which fails makes a screenshot of the desktop every 30 sec. Obviously the problem has to be from the init.d script. I tried to start the program in that script in the following ways:
$DAEMON &
exec $DAEMON &
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON &
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON & > /dev/null
Where $PIDFILE = /var/run/$NAME.pid ; $DAEMON = /usr/sbin/$NAME; $NAME = MyProgram
In all the cases i have the same result: one thread fails. Any ideas?