Find the answer to your Linux question:
Results 1 to 7 of 7
I have just installed an OBDII automobile code reader to get diagnostic codes. It is a python program run from the command line as root. Since I only will use ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2007
    Posts
    36

    Shell Script to Run Terminal as Root and cd and Execute a Command


    I have just installed an OBDII automobile code reader to get diagnostic codes. It is a python program run from the command line as root.

    Since I only will use this occasionally I would like to make a shell script to add to the panel so I don't have to remember the path file name and command to start it.

    I know that I can open the terminal with this command:

    /usr/bin/gnome-terminal

    The other commands if I could pass them to the terminal would be:

    sudo
    password
    cd /tmp/obdpy/pyobd-0.9/
    python wxgui.py

    Is there a way to do this?

    Thanks

  2. #2
    Linux Newbie
    Join Date
    Oct 2006
    Posts
    101
    Make a launcher the executes this command:
    Code:
    gnome-terminal -x "sudo python /tmp/obdpy/pyobd-0.9/wxgui.py"
    and see if it is what you are looking for.

    You can also configure sudo not to ask for your password.
    --Erik

  3. #3
    Just Joined!
    Join Date
    Jan 2007
    Posts
    36
    I get a "There was an error creating the child process" error.

    I see it actually opens the terminal twice.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Newbie
    Join Date
    Oct 2006
    Posts
    101
    maybe try to make it execute only:

    Code:
    sudo python /tmp/obdpy/pyobd-0.9/wxgui.py
    --Erik

  6. #5
    Just Joined!
    Join Date
    Jan 2007
    Posts
    36
    Nothing happens when I try that.

    I did put the first line directly into the application launcher and it only brings up one terminal with the error mentioned above. Also there is no command prompt on the terminal screen after I clear the error message.

    Is there a log file somewhere for the gnome terminal?

  7. #6
    Linux Newbie
    Join Date
    Oct 2006
    Posts
    101
    hmm, sorry I'm not sure. my only other thought would be to launch gnome-terminal with sudo and then just launch the command after the -x:

    Code:
    sudo gnome-terminal -x "python /tmp/obdpy/pyobd-0.9/wxgui.py"
    also make sure that is indeed the path to the file, the /tmp makes me worried.

    Good luck.
    --Erik

  8. #7
    Just Joined!
    Join Date
    Jan 2007
    Posts
    36
    Thanks,

    That didn't work either. I also tried just sudo gnome-terminal to see if that would bring up the terminal and it didn't.

Posting Permissions

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