Linux Startup Script after Gnome Login

Posted by Eric on Server Fault See other posts from Server Fault or by Eric
Published on 2012-11-13T14:45:48Z Indexed on 2012/11/13 17:02 UTC
Read the original article Hit count: 274

Filed under:
|

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.

© Server Fault or respective owner

Related posts about linux

Related posts about gnome