I tried to build myself a minimal launcher-menu that i can launch on a shortkey (through xbindkeys) and then run scripts/commands depending on another key i press (like "1" for "wlan on"+"start network-manager"+"nm-applet"). For that i run a simple bashscript with the help of "xterm -e".
My problem is that I do not manage to make a program run in the background, like nm-applet, after the script has quit. When i run nm-applet in the foreground, then the script does not end and the menu is shown. If i run it in the background (nm-applet &) then nm-applet starts, but is killed once the rest of my menu-script runs through. I tested this by adding a "sleep 5s" after the line for nm-applet.
By now i also tested other applications than nm-applet. So this is is not related only to this command. It's somehow related to the fact that i am using "xterm -e" (I also tried other terminals). Because when i open a terminal manually instead, run "nm-applet &" and close the terminal with ctrld+d, then nm-applet keeps running. Even when i run my menuscript from a terminal manually then nm-applet keeps running. Just when i run "xterm -e menuscript.sh" nm-applet quits once the script ran through.
Here is a small test that you can use if you want to experience the same:
- open a terminal
- run "zenity --info &" to show an example-window of zenity (ignore the "update"-text, it's just an example). The window will stay open and only close once you click ok.
- create a simple script. For example by entering "touch test.sh", "chmod +x test.sh" and editing the file the following way:
- run that script ("./test.sh"). You will notice that the window will still stay open until you click "ok".
- run "xterm -e test.sh" (or "terminal -e test.sh"). After 3 seconds the window will close.
I tried to find a solution on my own. Found stuff like "disown" (bash-command), tried subshells "(nm-applet)&", tried sub-scripts, but nothing helps. Maybe it would work to run the command not as sub-process but I have no idea how to make it run as parallel process.
Anyone got a clue?
My problem is that I do not manage to make a program run in the background, like nm-applet, after the script has quit. When i run nm-applet in the foreground, then the script does not end and the menu is shown. If i run it in the background (nm-applet &) then nm-applet starts, but is killed once the rest of my menu-script runs through. I tested this by adding a "sleep 5s" after the line for nm-applet.
By now i also tested other applications than nm-applet. So this is is not related only to this command. It's somehow related to the fact that i am using "xterm -e" (I also tried other terminals). Because when i open a terminal manually instead, run "nm-applet &" and close the terminal with ctrld+d, then nm-applet keeps running. Even when i run my menuscript from a terminal manually then nm-applet keeps running. Just when i run "xterm -e menuscript.sh" nm-applet quits once the script ran through.
Here is a small test that you can use if you want to experience the same:
- open a terminal
- run "zenity --info &" to show an example-window of zenity (ignore the "update"-text, it's just an example). The window will stay open and only close once you click ok.
- create a simple script. For example by entering "touch test.sh", "chmod +x test.sh" and editing the file the following way:
Code:
#!/bin/bash
zenity --info &
sleep 3s
- run that script ("./test.sh"). You will notice that the window will still stay open until you click "ok".
- run "xterm -e test.sh" (or "terminal -e test.sh"). After 3 seconds the window will close.
I tried to find a solution on my own. Found stuff like "disown" (bash-command), tried subshells "(nm-applet)&", tried sub-scripts, but nothing helps. Maybe it would work to run the command not as sub-process but I have no idea how to make it run as parallel process.
Anyone got a clue?
Last edited by a moderator: