I need to start an application on start up in Ubuntu. I have created a script in /etc/init which works fine when a monitor is connected, but if I disconnect the monitor and reboot, the script fails. I think the command export DISPLAY=:0; causes the problem. How can I change this command to run even if no display is connected?

exec su -l username -c 'export DISPLAY=:0; /App/exe'


Actually when I access the PC using team viewer when no display connected, I can see that desktop is appearing but the resolution is too small about 200X200 px. Also the app seems not running.

  • The solution provided here might be of help: unix.stackexchange.com/questions/326234/… – Mioriin Jun 7 '17 at 7:30
  • 1
    export DISPLAY=:0; will never fail; it just sets an environemnt variable. It's all about /App/exe. – Run CMD Jun 7 '17 at 9:54
  • Actually I can see the desktop using teamviewer but the resolution is too low some what 200 px. Also the the exe is not seems running. Actually the exe is Qt based app. – Haris Jun 7 '17 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.