I created the following Desktop Entry:
[Desktop Entry]
Type=Application
Terminal=true
Name=<name>
Exec=<pathTOscript/myScript.sh>
myscript.sh is just one command to start a service. The service starts the programm itself (CNTLM) and another script (own state).
sudo /etc/init.d/cntlm <ownstate>
Now my problem:
When I type the above command into a terminal: CNTLM stops, the script is executed, CNTLM starts, everything works fine.
However, when I click the shortcut, the terminal closes before CNTLM starts again.
Changing my .desktop to this solved the problem: Found it in this post.
[Desktop Entry]
Type=Application
Terminal=true
Name=<name>
Exec=gnome-terminal -e "bash -c 'sudo /etc/init.d/cntlm <ownstate>;$SHELL'"
The important here was "$SHELL".
Exec
command usingsudo
? How would you enter your password? – terdon Sep 09 '15 at 11:39sudo /etc/init.d/cntlm configure
is in the script. A terminal pop-ups and asks me for the password. The other script is executed and isn't the problem. The - i call it "branch" - back to init.d/cntlm is missing somehow. Can you put sudo directly into theExec
? Maybe this would help... – h0ch5tr4355 Sep 09 '15 at 11:48Terminal=false
? – terdon Sep 09 '15 at 11:50Terminal=false
isn't possible so. – h0ch5tr4355 Sep 09 '15 at 11:56