Update @ 2015-09-23: Frank suggested using incron to execute the sync base on file changes instead of time periods. Thanks!.
Whenever you have edited any page on Gollum, it will committed to the local repository which is checked out on the server. These commits WILL NOT be pushed to the Git Server. Similarly any push to the Git server will not sync to the repository running Gollum as it won’t execute git pull neither.
You may think of using the Git post-commit hook to trigger the synchronization whenever a commit is done but Gollum run Grit as the Git adapter and Grit doesn’t support hook.
A workaround suggested by Rod Hilton is to setup a cronjob and keep running the git push and pull on the server running Gollum.
So add the following sync.sh to your Gollum project root. Continue reading Gollum – Auto sync to git remote repository
Previously we talked about setting up some custom command in a Django project.
I would like to run the custom command in a regular interval. I could use Linux cronjob but it’s hard to manage and check the run history. It would be great if i could setup and manage these scheduled commands on the Django web portal.
django-chronograph, written by wnielson, is a Python Package which allows us to schedule any django-admin command through the web interface. It works well with the UTC timezone but if you have set the TIME_ZONE in your Django project setting.py, there would be time discrepancy.
For more detail about the bug, you can refer to the Issue #36 – Job doesn’t follow the Django’s TIME_ZONE setting.
Continue reading Django – Schedule django-admin command using django-chronograph
You can read/edit a linux user crontab by using the -u flag.
To edit the crontab of a specific linux user:
crontab -e -u <username>
Reference: how do I run a cron job with a specific user?
I have never tried to build a Drupal application with paid membership. Both Ubercart and Drupal Commerce provide membership subscription feature. This example is a proof of concept on implementing paid membership on Ubercart.
1. Enable the Roles module in Ubercart.
Continue reading Ubercart – Charge throught membership subscription on Drupal 7
Sometimes we may need to run some complex and time consuming tasks in Drupal cron but this may result in request timeout. It’s better to setup cron queues and run them in parallel requests.
Yesterday we have setup a hook_cron() task for batch updating nodes.
Drupal 7 – Batch update nodes by cron
Actually we can convert the tasks in the cron queues using hook_cron_queue_info() as follow.
Continue reading Drupal 7 – Use queues for long running tasks in cron
The following piece of code will update a field of a specific content type by SQL and it is written in a custom module with hook_cron(). Since it updates the database table directly so you have to use it with extreme caution.
Continue reading Drupal 7 – Batch update nodes by cron
You may meet the following error when trying to run a cron in Drupal
- Attempting to re-run cron while it is already running.
Or the cron was completed immediately after u input the cron.php url in browser. Continue reading Drupal – Cron Failure
How does the cron job in Drupal work? Let’s take a look.
// $Id: cron.php,v 1.36 2006/08/09 07:42:55 dries Exp $
* Handles incoming requests to fire off regularly-scheduled tasks (cron jobs).
Looks simple, right? the drupal_cron_run() function will run the default Drupal cron tasks as well as invoking the hook_cron() in all modules. Continue reading Drupal – Define Your Own Cron Job
Drupal has a cron.php at the root directory. you can run the this cron job by either entering the http://<drupal_root>/cron.php in browser or running it directly in the Drupal status report.
The default Drupal cron job cleans up log files and checks for Drupal and modules updates. If you want this cron job to be run at a regular interval, just edit the crontab by the following command.
and add one of the following lines with you desired interval. (45 mins in the following example) Continue reading Drupal – Add Task to the Drupal Cron Job
For housekeeping the backup files on a server, we can write a shell script to remove files which were created some days ago and scheduled it by cron job.
The following code is an example to remove backup files which were created 90 days ago. Please note that the target folder is just the same as the .sh file location and the .sh file is excluded in the command.
Continue reading Shell Script – Delete Old Files