Find the answer to your Linux question:
Page 1 of 4 1 2 3 4 LastLast
Results 1 to 10 of 33
Hello everybody, I would to start my computer and right after Linux finishes booting, a terminal automatically is opened and a certain program is started. Could anyone give me a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2011
    Posts
    38

    Auto execute program after booting


    Hello everybody,
    I would to start my computer and right after Linux finishes booting, a terminal automatically is opened and a certain program is started. Could anyone give me a hint how to do that?
    Thanks,
    Frederico Lima

  2. #2
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    hi

    There are multiple places one coulWhat should that program do (i.e. userinteraction, start ui, log startup, ..)?

  3. #3
    Just Joined!
    Join Date
    May 2011
    Posts
    38
    Hello Kloschüssel,
    the first problem is the autologin. I have install mingetty using:

    sudo apt-get install mingetty

    and I can't find the /etc/inittab which I should edit. I have read that the name changed to event.d or upstart but the ones I have seen are not the files which I should edit.

    After opening one terminal, the program which should run will collect data from sensors and print them out on there. There is an infinite loop for that.
    Thanks!

  4. #4
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    May this be what you're searching for?

    But I'm unsure about the "after opening a terminal ...". Reading that I'm believing you want to start up normally, log in manually and finally have an icon to click on which starts your sensor application in a console. Let me know if I'm wrong.

  5. #5
    Just Joined!
    Join Date
    May 2011
    Posts
    38
    The auto login was solved using the command gdmsetup.
    Now, I am trying to have some time of autostart for my program. Normally, the output of this program is displayed on the terminal which was used to start the program. So, that is why I was thinking about opening a terminal and then, executing the program....

  6. #6
    Just Joined!
    Join Date
    May 2011
    Posts
    38
    The xterm can be opened using:
    Settings -> Session and Startup -> Application Autostart

    I have tried to run a program using the Application Autostart but it still didn't work...

  7. #7
    Just Joined!
    Join Date
    Mar 2007
    Location
    Melbourne, Australia
    Posts
    30
    What about screen? I use it to auto start / stop my torrent server without having to login. Once I'm logged in though, I can attach to the the screen session and see what's happening.

    The magic is to start screen in 'background (or detached)' mode and connect to it whenever you need to. I start my torrent server via a cronjob as follows:
    Code:
    /usr/bin/screen -S torrent -d -m -fa /usr/bin/rtorrent
    I then attach to this screen session at any time by running:
    Code:
    screen -DR torr
    Please note that you do not have to enter the full word 'torrent' (see -S torrent in my start up command) as long as there are no other screen sessions that also start with 'torr!'

    See screen's man pages for what those options do and so much more!

    Cheers,
    ak.

  8. #8
    Linux User sgosnell's Avatar
    Join Date
    Oct 2010
    Location
    Baja Oklahoma
    Posts
    469
    You should be able to write a script which opens a terminal and then runs a program in it. Make the script executable and put it in your autostart.

  9. #9
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    gdm usually comes shipped with gnome. thus i assume you have a gnome frontent. you can use autostart to start an arbitrary script and you can therein start a terminal session with a specific command. the manual pages reveal how you pass a "command-to-be-executed" as arguments to the terminal.

  10. #10
    Just Joined!
    Join Date
    May 2011
    Posts
    38
    I have written a small shell script called test.sh:

    Code:
    #!/bin/bash
    ./helloworld
    bash
    Both "helloworld" and "test.sh" are located on the desktop.
    Using Settings -> Session and Startup -> Application Autostart, and writing the command
    Code:
    xterm -e ~/Desktop/test.sh
    , it works. But when I tried to run a program which is located somewhere else other than the desktop, it didn't.

Page 1 of 4 1 2 3 4 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •