Opening .desktop file outside of desktop immediately logs out
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
2
down vote
favorite
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!
command-line gnome bash scripts .desktop
add a comment |Â
up vote
2
down vote
favorite
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!
command-line gnome bash scripts .desktop
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
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!
command-line gnome bash scripts .desktop
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!
command-line gnome bash scripts .desktop
asked Jun 4 at 20:38
![](https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg?sz=32)
![](https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg?sz=32)
TheIntern
312
312
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
While I have my theories, I am afraid to proclaim that I know exactly (or even remotely) how or why this works. I would imagine that it has something to do with the way a *.desktop
launcher executes its target. Perhaps I was trying to kill the gnome-terminal window after it had already been closed at the end of the script's execution and ended up killing my session? Maybe vice versa? I don't claim to know, but I would invite anyone who does to please answer this question with your explanation so that others may learn from my mistake.
Removing the line kill -9 $PPID
solved the problem
If the script is executed from the *.desktop
launcher, the initial gnome-terminal
window will close, leaving the second. If the script is executed from the command line (for example, $ bash InitSystem
), the initial gnome-terminal
window does not close.
I think when one terminal window is closed all the processeses connected to the other end of the terminal get the SIGHUP signal, which by default terminates the process.
â Paul Stelian
Jun 4 at 21:27
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
While I have my theories, I am afraid to proclaim that I know exactly (or even remotely) how or why this works. I would imagine that it has something to do with the way a *.desktop
launcher executes its target. Perhaps I was trying to kill the gnome-terminal window after it had already been closed at the end of the script's execution and ended up killing my session? Maybe vice versa? I don't claim to know, but I would invite anyone who does to please answer this question with your explanation so that others may learn from my mistake.
Removing the line kill -9 $PPID
solved the problem
If the script is executed from the *.desktop
launcher, the initial gnome-terminal
window will close, leaving the second. If the script is executed from the command line (for example, $ bash InitSystem
), the initial gnome-terminal
window does not close.
I think when one terminal window is closed all the processeses connected to the other end of the terminal get the SIGHUP signal, which by default terminates the process.
â Paul Stelian
Jun 4 at 21:27
add a comment |Â
up vote
2
down vote
While I have my theories, I am afraid to proclaim that I know exactly (or even remotely) how or why this works. I would imagine that it has something to do with the way a *.desktop
launcher executes its target. Perhaps I was trying to kill the gnome-terminal window after it had already been closed at the end of the script's execution and ended up killing my session? Maybe vice versa? I don't claim to know, but I would invite anyone who does to please answer this question with your explanation so that others may learn from my mistake.
Removing the line kill -9 $PPID
solved the problem
If the script is executed from the *.desktop
launcher, the initial gnome-terminal
window will close, leaving the second. If the script is executed from the command line (for example, $ bash InitSystem
), the initial gnome-terminal
window does not close.
I think when one terminal window is closed all the processeses connected to the other end of the terminal get the SIGHUP signal, which by default terminates the process.
â Paul Stelian
Jun 4 at 21:27
add a comment |Â
up vote
2
down vote
up vote
2
down vote
While I have my theories, I am afraid to proclaim that I know exactly (or even remotely) how or why this works. I would imagine that it has something to do with the way a *.desktop
launcher executes its target. Perhaps I was trying to kill the gnome-terminal window after it had already been closed at the end of the script's execution and ended up killing my session? Maybe vice versa? I don't claim to know, but I would invite anyone who does to please answer this question with your explanation so that others may learn from my mistake.
Removing the line kill -9 $PPID
solved the problem
If the script is executed from the *.desktop
launcher, the initial gnome-terminal
window will close, leaving the second. If the script is executed from the command line (for example, $ bash InitSystem
), the initial gnome-terminal
window does not close.
While I have my theories, I am afraid to proclaim that I know exactly (or even remotely) how or why this works. I would imagine that it has something to do with the way a *.desktop
launcher executes its target. Perhaps I was trying to kill the gnome-terminal window after it had already been closed at the end of the script's execution and ended up killing my session? Maybe vice versa? I don't claim to know, but I would invite anyone who does to please answer this question with your explanation so that others may learn from my mistake.
Removing the line kill -9 $PPID
solved the problem
If the script is executed from the *.desktop
launcher, the initial gnome-terminal
window will close, leaving the second. If the script is executed from the command line (for example, $ bash InitSystem
), the initial gnome-terminal
window does not close.
edited Jun 5 at 3:55
![](https://i.stack.imgur.com/A4LiS.jpg?s=32&g=1)
![](https://i.stack.imgur.com/A4LiS.jpg?s=32&g=1)
pomsky
21.3k76494
21.3k76494
answered Jun 4 at 20:57
![](https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg?sz=32)
![](https://lh3.googleusercontent.com/-XdUIqdMkCWA/AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/photo.jpg?sz=32)
TheIntern
312
312
I think when one terminal window is closed all the processeses connected to the other end of the terminal get the SIGHUP signal, which by default terminates the process.
â Paul Stelian
Jun 4 at 21:27
add a comment |Â
I think when one terminal window is closed all the processeses connected to the other end of the terminal get the SIGHUP signal, which by default terminates the process.
â Paul Stelian
Jun 4 at 21:27
I think when one terminal window is closed all the processeses connected to the other end of the terminal get the SIGHUP signal, which by default terminates the process.
â Paul Stelian
Jun 4 at 21:27
I think when one terminal window is closed all the processeses connected to the other end of the terminal get the SIGHUP signal, which by default terminates the process.
â Paul Stelian
Jun 4 at 21:27
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1043615%2fopening-desktop-file-outside-of-desktop-immediately-logs-out%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password