Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How To Create A Startup Script To Run Both Grunt Watch and XAMPP

Writer Mia Lopez

I'm new to Linux and Ubuntu and I'm a web developer.

I created this small script to run Grunt watch and XAMPP at the same time.

#!/bin/bash
sudo /opt/lampp/lampp start
cd /home/mohammed/Dropbox/htdocs/my-site
grunt watch

My script name is web-services.sh and currently it lives in my home directory.

I run this script each time I turn on my computer from the terminal.

I read many tutorials and tried many times to make this script run at startup but each time I try only the XAMPP run!

Please explain your answer in step by step process, for example where should I put the script in /etc/init.d or in another location and the commands that I need to run to make it work and so on and so forth.

Any help will be appreciated.

1 Answer

That could be that the sudo /opt/lampp/lampp start is not put in the background, so your script wait for it to stop before continuing.

Did you try to launch it in the background ? You can do that by adding a & at the end of the line :

#!/bin/bash
sudo /opt/lampp/lampp start &
cd /home/mohammed/Dropbox/htdocs/my-site
grunt watch
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy