Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
4 Not blockquoted code; properly indent the actual code
source | link
Have just found this great little script

Have just found this great little script:

#!/bin/bash
    service=replace_me_with_a_valid_service

    if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
    then
      echo "$service is running!!!"
    else
      /etc/init.d/$service start
    fi

Source

Have just found this great little script
#!/bin/bash
    service=replace_me_with_a_valid_service

    if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
    then
      echo "$service is running!!!"
    else
      /etc/init.d/$service start
    fi

Source

Have just found this great little script:

#!/bin/bash
service=replace_me_with_a_valid_service

if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
  echo "$service is running!!!"
else
  /etc/init.d/$service start
fi

Source

3 added 4 characters in body
source | link
Have just found this great little script
#!/bin/bash
    service=replace_me_with_a_valid_service

    if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
    then
      echo "$service is running!!!"
    else
      /etc/init.d/$service start
    fi

Source

Have just found this great little script
#!/bin/bash
    service=replace_me_with_a_valid_service

    if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
    then
    echo "$service is running!!!"
    else
    /etc/init.d/$service start
    fi

Source

Have just found this great little script
#!/bin/bash
    service=replace_me_with_a_valid_service

    if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
    then
      echo "$service is running!!!"
    else
      /etc/init.d/$service start
    fi

Source

2 Added source of this script
source | link
Have just found this great little script
#!/bin/bash
    service=replace_me_with_a_valid_service

    if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
    then
    echo "$service is running!!!"
    else
    /etc/init.d/$service start
    fi

Source

Have just found this great little script
#!/bin/bash
    service=replace_me_with_a_valid_service

    if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
    then
    echo "$service is running!!!"
    else
    /etc/init.d/$service start
    fi
Have just found this great little script
#!/bin/bash
    service=replace_me_with_a_valid_service

    if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
    then
    echo "$service is running!!!"
    else
    /etc/init.d/$service start
    fi

Source

1
source | link