# Mongrel restart script in .sh file is not working

**URL:** <https://www.ruby-forum.com/t/mongrel-restart-script-in-sh-file-is-not-working/223413>\
**Category:** Mongrel\
**Created:** [October 3, 2012, 9:48am UTC](https://www.ruby-forum.com/t/mongrel-restart-script-in-sh-file-is-not-working/223413 "2012-10-03T09:48:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [October 3, 2012, 9:48am UTC](https://www.ruby-forum.com/t/mongrel-restart-script-in-sh-file-is-not-working/223413/1 "2012-10-03T09:48:04Z")

</div>

When I run script to restart mongrel written in .sh file , It is not  
working properly.

Below are the commands written in .sh file.

cd /home/apps/stage/bd/log && rm mongrel.pid -f pkill -9 mongrel\_rails  
-u bandega cd /home/apps/stage/bd && mongrel\_rails start -e production  
-p 4184 -d

But when I manually run all above commands one by one on terminal, It is  
working properly and server is started properly.

Is there are some problems while running script in .sh file?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![dipali](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bcef8e/32.png) [@dipali](https://www.ruby-forum.com/u/dipali)\
**Post date:** [October 3, 2012, 4:24pm UTC](https://www.ruby-forum.com/t/mongrel-restart-script-in-sh-file-is-not-working/223413/2 "2012-10-03T16:24:56Z")

</div>

try breaking your script down into multiple lines and not using the &&  
operator

it looks like there are some spots in the shell script where there  
should be a break, such as between the ‘rm’, ‘pkill’ and the ‘cd’

---

<div class="post-metadata">

**Author:** ![dipali](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/bcef8e/32.png) [@dipali](https://www.ruby-forum.com/u/dipali)\
**Post date:** [October 3, 2012, 4:30pm UTC](https://www.ruby-forum.com/t/mongrel-restart-script-in-sh-file-is-not-working/223413/3 "2012-10-03T16:30:47Z")

</div>

> try breaking your script down into multiple lines and not using the && operator

and then add the && back in once you get the script working
