Sample Header Ad - 728x90

opening a terminal with a command on startup in debian

0 votes
1 answer
2002 views
I have an application which is an object file (obtained from a c source code). When I run this application from the terminal it works fine. I want to run this application on system start up. Since all the log data currently I am printing on the terminal, I want to open the terminal and run this application in terminal (so that I can see the live log and also give input to my application from terminal). After searching some tutorials I am able to create a service which runs a shell script on startup. I modified this script to open a terminal and run the application. If I run the shell script only from the terminal it works well. But when I am running the script from service I am getting following warning:
(x-terminal-emulator:16048): Gtk-WARNING **: cannot open display:
Where am I making mistake? Here I am using beaglebone black running with debian. * This is my service file (application.service)
-ini
    [Unit]
    Description=application setup
    
    [Service]
    WorkingDirectory=/root/application/
    ExecStart=/root/application/start_application
    SyslogIdentifier=application
    Restart=on-failure
    RestartSec=5
    
    [Install]
    WantedBy=multi-user.target
* Here is start_application.sh
-shell
    #! /bin/sh
    #
    # start_app_server
    #

    echo "Starting application server"
    x-terminal-emulator -e "app_server/a.out"

    echo Done
Asked by Edge G (1 rep)
Aug 11, 2015, 10:52 AM
Last activity: Jul 19, 2025, 03:10 PM