Cron is UNIX/Linux service or daemon to execute scheduled commands according to instruction in a file. It uses a daemon, crond, which runs constantly in the background and checks every minute/ hour/ day/ week/ month or an year (based on the configuration) to see if any of the scheduled jobs need to be executed; if so, it executes them. These jobs are generally referred to as cron jobs.
You can use the OpenShift Enterprise cron scheduler to set up timed jobs for your applications. This would need a running Openshift application, a cron cartridge (cron-1.4) and a cronjob script.
You can automatic backup snapshot or mysql database:
First: You need create an account from openshift, its free limit 3 small gear for testing code…
- $ rhc app create -a app -t php-5.3
Second: Enable Crontab on your App
- rhc app cartridge add -a app -c cron-1.4
Third: Go to Crontab to configure it
- cd app-root/runtime/repo/.openshift/crontab
- //daily hourly minutely monthly README.cron weekly >> Choose an folder to set it auto run backup job
Last: Choose an folder to set it auto run backup job, I have test on daily auto backup job.
- cd daily
- nano bk
- //Copy and paste the bak script.
- mysqldump -h $OPENSHIFT_MYSQL_DB_HOST -P $OPENSHIFT_MYSQL_DB_PORT -ppassword -u username yourdata > /var/lib/openshift/xxxxxxxxxx/yourpath/$OPENSHIFT_GEAR_NAME.sql
- chmod a+x bk