Prevent Gnome Terminal Logout After Execution

How do you prevent the gnome terminal from exiting after issuing this command?

I call gnome-terminal from cronjob to create a terminal accessible to the user. Initially, the terminal receives a specific program to run. eg.

gnome-terminal --tab -e "/usr/bin/myprog" 

This works fine, except that when "myprog" completes, it also makes a gnome terminal. How to save it, but just go back to the terminal prompt?

+17
linux bash terminal gnome-terminal
Dec 16 '10 at 22:20
source share
4 answers

Try the following:

 gnome-terminal --tab -e "/bin/bash -c '/usr/bin/myprog; exec /bin/bash -i'" 
+20
Dec 17 '10 at 0:01
source share

alt text

Create a profile (i.e. hold), set "When the command exits: keep the terminal open", and then

 $ gnome-terminal --tab --profile hold -e /usr/bin/myprog 
+21
Dec 17 '10 at 7:18
source share

Create a shell script as follows:

 #!/bin/bash # myprog-wrapper.sh - runs /usr/bin/myprog and then starts a new bash session /usr/bin/myprog /bin/bash 

Give the shell script permission to execute.

Then configure your cron job to call this script instead of directly calling myprog :

 gnome-terminal --tab -e "/path/to/myprog-wrapper.sh" 

Replace /bin/bash your choice shell.

+3
Dec 16 '10 at 10:40
source share

You can use xterm or rxvt-unicode instead of gnome-terminal, both of which have the -hold for this purpose.

+2
Dec 17 '10 at 1:31
source share



All Articles