title: how to setup cronjobs in cakephp
body: <p>I'm trying to setup a cronjobs in cakephp3, I can create a command class</p>
  
  <pre><code>class RescanCommand extends Command { 
  public function sendMail() {
      $email = new Email();
  
      // Sample SMTP configuration.
      Email::setConfigTransport('mailtrap', [
          'host' =&gt; 'smtp.mailtrap.io',
          'port' =&gt; 25,
          'username' =&gt; 'username',
          'password' =&gt; 'pass',
          'className' =&gt; 'Smtp'
      ]);
  
      $email-&gt;setFrom(['test@test.com' =&gt; 'CSV file'])
          -&gt;setTo('test@test.com')
          -&gt;setSubject('CSV Link File')
          -&gt;send('Please find attached a copy of the links');
  }
  
  public function execute(Arguments $args, ConsoleIo $io) {
      $this-&gt;sendMail();
  }
  } 
  </code></pre>
  
  <p>in order to setup the cronjob, I have to login to cpanel and create a cronjob in the format </p>
  
  <blockquote>
    <p><a href="https://sontest.000webhostapp.com/myscript.php" rel="nofollow noreferrer">https://sontest.000webhostapp.com/myscript.php</a></p>
  </blockquote>
  
  <p>for setting up the cronjob in cakephp I have to write</p>
  
  <blockquote>
    <ul>
    <li><ul>
    <li><ul>
    <li><ul>
    <li><ul>
    <li>cd /Application/MAMP/htdocs/music &amp;&amp; bin/cake rescan execute</li>
    </ul></li>
    </ul></li>
    </ul></li>
    </ul></li>
    </ul>
  </blockquote>
  
  <p>my question is how can I make the cronjob for the server and access it through the cpanel, I need to have the script in the webroot to access.</p>
  
  <p>any help would be appreciate it.</p>