Run multiple commands in Linux Launcher

If you want to run multiple commands in launcher.




Example:- If you want to stop apache2 (httpd) & mysql (mysqld) simultaneously. You would use 

service apache2 stop && service mysql stop
or
service httpd stop && service mysqld stop

But unfortunately it won't work in Launcher. It runs the first command but does not execute second.

To run multiple commands as a Launcher, you should use
sh -c "service apache2 start && service mysql start"
Now when you run launcher, it executes all commands.

If you want to run three commands,
sh -c "service apache2 start && service mysql start && cat > redirect"
In above example, it would start both services as well as create a file redirect.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...