Apache Start .sh script -


#!/bin/bash # apache process monitor # restart apache web server when goes down # ------------------------------------------------------------------------- # copyright (c) 2003 nixcraft project <http://cyberciti.biz/fb/> # script licensed under gnu gpl version 2.0 or above # ------------------------------------------------------------------------- # script part of nixcraft shell script collection (nssc) # visit http://bash.cyberciti.biz/ more information. # ------------------------------------------------------------------------- # rhel / centos / fedora linux restart command restart="/sbin/service httpd restart"  # uncomment if using debian / ubuntu linux #restart="/etc/init.d/apache2 restart"  #path pgrep command pgrep="pgrep" # httpd daemon name, # under rhel/centos/fedora httpd # under debian 4.x apache2 httpd="httpd" # find httpd pid $pgrep ${httpd} if [ $? -ne 0 ] # if apache not running # restart apache $restart fi exit 

this script. when run : command not foundin/apache_start.sh: line 12: : command not foundin/apache_start.sh: line 22: pgrep /usr/local/apache/bin/apache_start.sh: line 29: syntax error: unexpected end of file

what mistake made. happy if answer me.

dude, ran script , works fine except $pgrep ${httpd} part, if want pid why don't use "pidof" command, , think in if statement testing return value of grep, not httpd command(not sure).
anyway did edit script in word document or in editor, cause know may add invisible characters code.
debug it, suggest comment out rest of code first error , see figure out solution specific error.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -