This is my first question with Ask Ubuntu, so I'd like to thank you in advance for your patience.
My situation is this:
I have a *.desktop
file (which I wrote) that is supposed to execute a shell script. My initial intent was to place this file in ~/.config/autostart
so that it would run automatically at startup; however, this causes Ubuntu to flash the desktop for a split second, then log me back out. I can double click the file on my desktop and it will launch the script like it's supposed to. If I take the *.desktop
file out of the ~/Desktop
directory and put it literally anywhere else, double clicking it in Nautilus will also result in me being logged out immediately.
The *.desktop
file is set to execute a shell script which starts bash
in gnome-terminal
. My reasons for doing this are not necessarily important, so please assume that that's the way I need it to be. If I add sleep 10
to the beginning of the first shell script, I am logged out 10 seconds after starting the *.desktop
file, regardless of how it is started. It seems like the problem is in the fact that a new gnome-terminal
window is started from the second script, but I don't understand how or why this would be.
Desktop entry:
[Desktop entry]
Name=Autocapture
Comment=Starts autocap program
Exec=/Autocapture/Startup/InitSystem
Terminal=false
Type=Application
InitSystem:
#!/bin/bash
nohup gnome-terminal --title=Autocapture --maximize -e "bash -c 'bash /Autocapture/Startup/StartAutocap.sh';bash"
wmctrl -a "Autocapture" # Give focus to new terminal window
kill -9 $PPID # Close this terminal
StartAutocap.sh:
#!/bin/bash
source /usr/local/bin/virtualenvwrapper.sh
workon Autocap
python /path/to/python/module.py
This is supposed to (and successfully does, if launched from desktop) start a fullscreen gnome-terminal
window running bash
and launch the "module.py
" program in that bash session. It also closes the first gnome-terminal
window that started and detached the child process.
Sorry for the incredibly long first post. I just want to understand what is going wrong here and how I might be able to fix it. Any help is greatly appreciated!