Results 1 to 4 of 4

Thread: How to autostart programs in virtual console?

  1. #1
    Join Date
    Mar 2013
    Beans
    13

    How to autostart programs in virtual console?

    Hello world!

    I've got a little problem. I need 2 programs to start automatically in virtual consoles after I start the system.
    Till now all my attepts have failed. I'll try to describe the process in few words and maybe someone could help me do it.


    My enviroment builds like this: (I use compilation with kernel 3.2)
    I do as follow:
    Ubuntu server default installation with server ssh and next:
    Code:
    aptitude install xserver-xorg xserver-xorg-core  xserver-xorg-input-evdev xserver-xorg-video-ati lightdm unity-greeter  openbox roxterm
    echo 'export DISPLAY=:0' >> ~/.bashrc
    aptitude install build-essential dkms unzip
    aptitude build-dep fglrx
    I add auto-login to /etc/lightdm/lightdm.conf

    Code:
    [SeatDefaults]
    greeter-session=unity-greeter
    user-session=openbox
    autologin-user=my_username
    autologin-user-timeout=0
    and
    Code:
    usermod -a -G nopasswdlogin my_username
    next I install Catalyst from AMD site
    Code:
    wget ADM_drivers
    unzip AMD_drivers
    sh AMD_drivers
    amdconfig --adapter=all --initial -f
    reboot
    next openssh server configuration and everything works fine.

    Programs I use work in terminal and now I do this:


    After system starts I run roxterm and with


    Code:
    screen -S name


    I create virtual console and run first of my programs, next "CTRL+A+D". After that I create second session and run second program, "CTRL+A+D" and that"s it.
    Thanks to that I can login through ssh and use screen to check on my programs. But I need those 2 programs run automatically in virtual consoles after I start the system to make my server headness


    Please let me know if you have any solution. Your help will be very apprecieated.
    Last edited by navoye; April 5th, 2013 at 03:01 AM.

  2. #2
    Join Date
    Sep 2006
    Location
    Brisbane, Australia
    Beans
    26
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: How to autostart programs in virtual console?

    I suggest you take a look at this thread: http://ubuntuforums.org/showthread.php?t=953750.

    The main think to know is to use
    Code:
    su - <username>
    or
    Code:
    sudo -u <username>
    to select which user to run the screen as, and then to start the screen.

  3. #3
    Join Date
    Mar 2013
    Beans
    13

    Re: How to autostart programs in virtual console?

    Thank You for Your answer, but I dont have full desktop environment and i can only run xterm in mine(i dont have possibilty to System>Preferences>Sessions). Also my user is auto-login with lightdm so i think i can run screen as this user, dont need to use sudo(but mayby i'm wrong) - very important for me is NOT to run those programs before my desktop will run - so i think the best way will be to add it somewhere after auto-login(but where and how?)
    could You tell me where (in which file) add those run commands or in which manual should i look for instructions?

  4. #4
    Join Date
    Sep 2006
    Location
    Brisbane, Australia
    Beans
    26
    Distro
    Ubuntu 12.10 Quantal Quetzal

    Re: How to autostart programs in virtual console?

    When a shell is started, there is a file that is run to set it up. This is usually called
    Code:
    .bash_profile
    (or
    Code:
    .profile
    or
    Code:
    .bash_login
    ), and is placed in the user home directory. You could add the commands you want executed to the bottom of this file, or run a script from there also. If you put your commands in a bash script file, ensure you make it executable (
    Code:
    chmod +x scriptname
    ).

    You could also look into using Upstart to run a script on startup (I haven't tried this before) - http://upstart.ubuntu.com/cookbook/#what-is-upstart

    Taken from http://askubuntu.com/questions/17394...system-startup and http://askubuntu.com/questions/98433...ing-bash-login
    Ubuntu Member | Australian LoCo Team Member
    Registered Ubuntu User #18788 | Registered Linux User #440350

Bookmarks

Posting Permissions

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