You are not logged in.
Pages: 1
hi
I use Xfce 4.12 on Xubuntu 15.10 and I need to launch those two commands at the same time:
sudo /etc/init.d/apache2 start
and
sudo /etc/init.d/mysql start
I've tried with
"sudo /etc/init.d/apache2 start && sudo /etc/init.d/mysql start"
but without success.
How can I do?
Many thanks!
Offline
Hello and welcome.
The problem with using sudo in a launcher command is that you won't have the ability to enter your password (if sudo is so configured). You can try:
1. Use gksu/gksudo (or pkexec) instead. These will prompt you for a password via an graphical dialog.
2. Fire up an instance of the terminal and run these commands in there - this will allow you to enter your password. A launcher command like:
xfce4-terminal -x "sudo /etc/init.d/apache2 start && sudo /etc/init.d/mysql start"
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
I've tried the 2th but it doesn't work: two terminal window opened but no password asked
Instead a launcher with just:
sudo /etc/init.d/apache2 start
works: a terminal window is open, I insert my sudo password e the command is executed.
See my pic: http://imgur.com/y7Q4Dl5l.png
Offline
Sorry, that should be "-e" if using quotes or "-x" if no quotes are used. So:
xfce4-terminal -x sudo /etc/init.d/apache2 start && sudo /etc/init.d/mysql start
...or:
xfce4-terminal -e "sudo /etc/init.d/apache2 start && sudo /etc/init.d/mysql start"
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
I've tried your 2 commands but, after I've typed the sudo password, only the first (Apache) is executed
Offline
Hmmm.
Try this. Create another file with the following contents:
#!/bin/bash
sudo /etc/init.d/apache2 start
sudo /etc/init.d/mysql start
Make this file executable.
Then from your launcher, run this script via:
xfce4-terminal -x sudo /path/to/the/script
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Offline
If you're running the script with sudo, you don't need to put it on every line inside the script as the entire thing is being run as root.
Registered Linux user #470359
Permanently recovered BOFH
Any advice in this post is worth exactly what you paid for it.
Offline
thanks! creating another file with two commands it works. Even if I wanted to avoid creating a file for each launcher...
Offline
Pages: 1
[ Generated in 0.013 seconds, 8 queries executed - Memory usage: 545.97 KiB (Peak: 546.81 KiB) ]