Find the answer to your Linux question:
Results 1 to 8 of 8
Hello everyone, my system has an autologin as root defined by custom.conf which is located in /etc/gdm : Code: [daemon] TimedLoginEnable=false AutomaticLoginEnalbe=true TimedLogin=root AutomaticLogin=root TimedLoginDelay=30 And I would like to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2011
    Posts
    38

    Autostart program as root after autologin


    Hello everyone,
    my system has an autologin as root defined by custom.conf which is located in /etc/gdm :
    Code:
    [daemon]
    TimedLoginEnable=false
    AutomaticLoginEnalbe=true
    TimedLogin=root
    AutomaticLogin=root
    TimedLoginDelay=30
    And I would like to have the program "expfit_spifunc2" executed after the auto login. So, I have added "xterm_expfit.desktop" inside of /root/.config/autostart

    "xterm_expfit.desktop" code:

    Code:
    [Desktop Entry]
    Encoding=UTF-8
    Version=0.9.4
    Type=Application
    Name=xterm_expfit
    Comment=expfit_spifunc2
    Exec=xterm -geometry 80x24-30+0 -e /home/levmar-2.5/test.sh
    StartupNotify=false
    Terminal=false
    Hidden=false
    And last, the "test.sh" is shown bellow:
    Code:
    #!/bin/bash
    /home/levmar-2.5/expfit_spifunc2
    bash
    However, it does not even open the xterm to run the program. Could anyone give me any idea about what could be happening?
    Thanks for your attention!
    Frederico Lima

  2. #2
    Linux User sgosnell's Avatar
    Join Date
    Oct 2010
    Location
    Baja Oklahoma
    Posts
    471
    One of the lines is "Terminal=false". I haven't tried this exact thing, but I would expect that variable should be set to true if you want an actual terminal to be shown.

  3. #3
    Just Joined!
    Join Date
    May 2011
    Posts
    38
    Thanks for the suggestion,
    but I have just changed it to "Terminal=true" and nothing changed...

  4. #4
    Linux User sgosnell's Avatar
    Join Date
    Oct 2010
    Location
    Baja Oklahoma
    Posts
    471
    I've never tried running a script that way. Have you tried System/Preferences/Startup Programs, and adding your script to that list? It should run as root from there, by just putting in the path to the script, as long as the script has the executable bit set. I don't know what distro you're running, so this might not work, but it should work for any Debian-derived distro.

  5. #5
    Just Joined!
    Join Date
    May 2011
    Posts
    38
    Sgosnell, as you have seen in the other thread (Auto execute program after booting), I was trying to execute a script with an user but I got stuck since the program was not executed without someone typing the password. That way, I had the whole graphical interface and I could use:
    Settings -> Session and Startup -> Application Autostart

    The autologin as root only gives me a terminal and nothing else. That is why I have done it this way.

    By the way, I have been using Ubuntu 9.10 karmic.

  6. #6
    Linux User sgosnell's Avatar
    Join Date
    Oct 2010
    Location
    Baja Oklahoma
    Posts
    471
    In Ubuntu, you should be able to go to System/Preferences/Startup Programs and add your script to the list of startup programs. These should run as root without needing a password. You can also copy the script to /usr/bin, or /usr/local/bin and have it run at startup this way. Running it from /home/user might be a problem in Ubuntu, I can't recall exactly, but putting it in /usr/bin should work.

  7. #7
    Just Joined!
    Join Date
    May 2011
    Posts
    38
    I have copied the "test.sh" inside of both folders which you have mentioned and changed the path in the "xterm_expfit.desktop" but it does not work.

    I can run the "test.sh" using root user exactly the way it should be. However, I have tested to autostart only an xterm but it does not work neither. It seems that when I am doing the autologin as root, the autostart does not work anymore.

  8. #8
    Just Joined!
    Join Date
    May 2011
    Posts
    38
    So, I have got the answer for my question and I would like to share it here.

    When Ubuntu does the autologin with user "root", it apparently does not run the file "xterm_expfit.desktop". So, the idea was to edit the file /root/.bashrc

    I have only added in the last line:
    /home/ebv/levmar-2.5/test.sh

    I have deleted the last line of test.sh and it looks like this now:
    Code:
    #!/bin/bash
    /home/levmar-2.5/expfit_spifunc2
    The line
    Code:
    bash
    seemed to be calling .bashrc again and there was an infinite loop.

Posting Permissions

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