I'm making a script to start up a number of services at server reboot. To do this, I'm looping over the directory, checking that each has a start.sh script, and calling that script if they do. However, as part of this, I would like to set up the script to ignore a service it has a select name, in this case mongo:
for service in $HOME/start/* ; do if [ -e $HOME/start/$service/start.sh ] && [ $service != mongo ] then cd $HOME/start/$service ./start.sh else pwd echo "No start script found for $service" fi done
This is because mongo is started before this loop is called, as a prequesite for the services, and you cannot have more than one instance of it at a time. However, it continues to loop and call mongo. How can I get it to ignore this?
Edit: corrected appName to service