Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a Fedora server that I want to spawn an interactive python script after the user logs on. This script will ask the user for various types of information for configuring the system or it will search for the previous config file and show them the predefined information. Originally I was going to put this in rc.local or make it run with init.d but that messed up the boot due to how the script is spawned. So I would like this script to run as soon as the user logs in to Gnome. I've searched around quite a bit and found this answer which appears to be exactly what I want, but it isn't working the way I want it to. Below is my entry.

[Desktop Entry]
Name=MyScript
GenericName=Script for initial configuration
Comment=I really want this to work
Exec=/usr/local/bin/myscript.sh
Terminal=true
Type=Application
X-GNOME-Autostart-enabled=true

Whenever I login, nothing happens. So I then did a test to modified "myscript.sh" to just echo some text to a file and it worked fine. So it appears the portion that isn't working is the script popping open a terminal and waiting for the users input. Are there any additional options I need to add to make this work? I can confirm when I run /usr/local/bin/myscript.sh from the CLI it works fine. I have also tried adding "StartupNotify=true" and still no luck.

Edit @John - I tried moving my Exec= to /usr/local/bin/myscript-test and this is what myscript-test contains.

#!/bin/bash 
xterm -e /usr/local/bin/myscript.sh

Yet again, when I just run the myscript-test it works fine. However when I put that in my autostart, nothing happens.

Edit 2 - I did a few more tests and it did start working but I had to remove Terminal=True before the xterm would pop. Thanks for your help.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

This is just a guess, but it smells like the original "myscript.sh" simply launches the Python script. You don't have a terminal, so it doesn't know to open one. If this is the case, you need to explicitly start a terminal in myscript.sh, and launch the Python script inside that terminal. Something along the lines of "xterm -e " should do it (that was from an admittedly bad memory, and I don't have a man page available for xterm, so please don't try it verbatim).

share|improve this answer
    
Correction... it worked. Thank you. –  Eric Nov 13 '12 at 15:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.