I'm trying to setup a cron job to run a console command every minute.
class RescanCommand extends Command {
public function sendMail() {
$email = new Email();
// Sample SMTP configuration.
Email::setConfigTransport('mailtrap', [
'host' => 'smtp.mailtrap.io',
'port' => 25,
'username' => 'username',
'password' => 'pass',
'className' => 'Smtp'
]);
$email->setFrom(['test@test.com' => 'CSV file'])
->setTo('test@test.com')
->setSubject('CSV Link File')
->send('Please find attached a copy of the links');
}
public function execute(Arguments $args, ConsoleIo $io) {
$this->sendMail();
}
}
I can run the above code from command line by
bin/cake rescan execute
and I receive the test email, but after creating a cron job by editing cron tabs like
crontab -e
and inside the file by writing
*/1 * * * * cd /Applications/MAMP/htdocs/music && bin/cake Rescan execute
nothing happens, I was expecting to receive emails every minute,
can anyone please help find out what I'm doing wrong.
Thanks