title: Running script in crontab--reboot: command not found
body: <p>I've set a script in my root crontab that is supposed to restart my machine with the <code>reboot</code> command. </p>
  
  <p>However, I am getting a <code>reboot: command not found</code> despite the fact that <code>reboot</code> is in the root user's path.</p>
  
  <pre><code>$ sudo su
  $ which reboot
  /sbin/reboot
  $ echo $PATH
  /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin
  </code></pre>
  
  <hr>
  
  <p>My script:</p>
  
  <pre><code>#!/bin/bash
  
  ping 8.8.8.8 -c 1 &gt; /dev/null 2&gt;&amp;1; exit_code=$?
  time_stamp=$(date +"%Y%m%d-%H%M")
  
  if [ $exit_code -ne 0 ]; then
      (1&gt;&amp;2 echo "$time_stamp: failed with exit code $exit_code; restarting now")
      reboot
  else
      echo "$time_stamp: ok"
  fi
  </code></pre>
  
  <hr>
  
  <p>root user crontab:</p>
  
  <pre><code>$ sudo crontab -l
  58 * * * * /home/pi/github/ping-restart/ping-restart.sh &gt;&gt; /home/pi/github/ping-restart/cron.log 2&gt;&amp;1
  $ sudo su
  58 * * * * /home/pi/github/ping-restart/ping-restart.sh &gt;&gt; /home/pi/github/ping-restart/cron.log 2&gt;&amp;1
  </code></pre>
  
  <hr>
  
  <p>...yes, this is only a temporary workaround while I figure out why the internet keeps dropping. </p>