So I would like to periodically run a script in my application that Im running on openshift PaaS. I would like to periodically delete some entries from my database. I've installed CRON cartridge and I have put a bash script which looks like this:
#!/bin/bash
php /erase.php
in .openshift/cron/minutely which should run a script every minute. Ive put erase.php in the root folder of my git repository, so I think that there are no errors in code above. My erase.php looks like this:
<?php
try {
$bdd = new PDO('mysql:host=127.*.***.*:****;dbname=track', '****', '*****');
} catch(Exception $e) {
exit('Unable to connect to db.');
}
$sql = "DELETE FROM table";
$q = $bdd->prepare($sql);
$q->execute();
?>
As far as I can see there can't be anything wrong with the above code. Is there something else that I'm missing?
EDIT: Problem is solved, in bash script the path has to be like this: php $OPENSHIFT_REPO_DIR/erase.php