My main question is: Is it possible to run an OPENGL program via a daemon (upstart script)? The program displays a window on the screen.
More details: I have an opengl program (done with openframeworks, C++) that i want to run with a daemon.
Manually i start my program in the terminal like this:
planeviz@planeviz:~/src/of/apps/myApps/planeEtoiles/bin$ ./planeEtoiles
Now i created an upstart script (/etc/init/myapp.conf), that should start the program when the computer boots, and make sure to restart it in case of crashes.
# job file
description "myapp"
author "eva"
# When to start the service
start on startup
start on runlevel [2345]
# When to stop the service
stop on runlevel [016]
# Automatically restart process if crashed
respawn
# Start the process
script
sudo /home/planeviz/src/of/apps/myApps/planeEtoiles/bin/planeEtoiles
end script
Then i try to start the daemon via
sudo service myapp start
My application doesn't open. dmesg tell me:
planeviz@planeviz:/etc/init$ dmesg | grep "init:"
[ 5282.003496] init: myapp main process (8008) terminated with status 139
Termination status 139 seems to hint at a segmentation fault. Looking at the output of my program in the upstart log, i see the last error to be related to the creation of the opengl window.
planeviz@planeviz:/etc/init$ sudo tail /var/log/upstart/planeetoiles.log
....
[ error ] ofAppGLFWWindow: couldn't init GLFW
This makes me wonder if its even possible to run OPENGL programs with upstart, or if it is only meant to work with background processes?