Showing posts with label cron. Show all posts
Showing posts with label cron. Show all posts

Tuesday, October 20, 2015

running rvm based cron job

rvm is requires a bash login to work.
in order to execute cron jobs, run this:

*/5 * * * * 'sh /home/myuser/versions/current/runme.sh'

create a shell file,
change working directory to rails root,
and run the required job, such as delayed_job once and exit

vi /home/myuser/versions/current/runme.sh
cd /home/myuser/versions/current
/bin/bash -l -c 'RAILS_ENV=production bundle exec rake jobs:workoff'



Sunday, January 17, 2010

drupal cron for multiple sites

There are times when we have multiple site to maintain for our drupal based websites.
One way to do it is by doing a shell script.
But i would prefer to do it using php script instead:

runcron.php
------------------------

$aSites = array(
"http://xyz.com/cron.php",
"http://example.com/cron.php"
);
foreach( $aSites as $sSite ):
$sContent = file_get_contents($sSite);
echo "Retrieved: " . $sSite . "\r\n
";
echo substr($sContent,0, 100) . "...\r\n
";
endforeach;

-------------------
And setup the cron in cpanel:
php [path_to_your_php]/runcron.php
etc.: php /home/example.com/public_html/mydrupal/runcron.php > /dev/null

Hope this is helpful :)