How To Create A Startup Script To Run Both Grunt Watch and XAMPP
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 watchMy 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