title: Run service using cron job on CentOS 7
body: <p>I want to run <strong>apollo-broker-service</strong> service using <strong>cron job on CentOS 7</strong>.
  For this I am created a file <strong>/home/guest/start_apollo</strong> mentioned below</p>
  
  <pre><code>#!/bin/bash
  
  if pidof -x "apollo" &gt;/dev/null; then
  echo "Apollo MQTT is Running."
  else
  echo "Apollo MQTT is Stopped."
  service apollo-broker-service start
  fi
  </code></pre>
  
  <p>I am login with ssh root and run following command</p>
  
  <pre><code>cd /home/guest/
  chown root start_apollo
  chgrp -R root start_apollo
  chmod +x start_apollo
  </code></pre>
  
  <p>I want to run <strong>/home/nagios/start_apollo every 1 minute</strong> For this I added the following line into <strong>/etc/crontab</strong></p>
  
  <pre><code>01 * * * * root /home/nagios/start_apollo &gt; /var/log/start_apollo_service.log
  </code></pre>
  
  <p>I created a <strong>/var/log/start_apollo_service.log</strong> with following permission</p>
  
  <pre><code>-rwxr-xr-x   1 root   root         0 Aug 11 20:08 start_apollo_service.log
  </code></pre>
  
  <p>then <strong>restart crond service</strong> using below command</p>
  
  <pre><code>systemctl restart crond.service
  </code></pre>
  
  <p>After all this my cron job not working and there is no log created on /var/log/start_apollo_service.log</p>