Jump to content


Photo

Setting up Cron for the Lazy

cron

  • Please log in to reply
10 replies to this topic

#1 benovic

benovic

    Advanced Member

  • Members
  • PipPipPip
  • 60 posts

Posted 20 March 2013 - 12:09 AM

I got lazy and wrote a cron file for zurmo. If you are on a Debian system, you can save this as /etc/cron.d/zurmo

 

Don not forget to replace "/PATH/TO/YOUR/ZURMO/INSTALLATION" with your zurmo installation path.

 

# *    *    *    *    *  command to be executed
# -    -    -    -    -
# ¦    ¦    ¦    ¦    ¦
# ¦    ¦    ¦    ¦    ¦
# ¦    ¦    ¦    ¦    +----- day of week (0 - 7) (0 or 7 are Sunday, or use names)
# ¦    ¦    ¦    +---------- month (1 - 12)
# ¦    ¦    +--------------- day of month (1 - 31)
# ¦    +-------------------- hour (0 - 23)
# +------------------------- min (0 - 59)

#run these every minute
* * * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super EmailArchiving > /dev/null 2>&1
* * * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super ProcessOutboundEmail > /dev/null 2>&1

#run these every 2 minutes
*/2 * * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super Export > /dev/null 2>&1

# run these every 5 Minutes
0,5,10,15,20,25,30,35,40,45,50,55 * * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super Monitor > /dev/null 2>&1

# run these every 30 minutes
0,30 * * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super AddressGeocodeUpdate > /dev/null 2>&1

#run these once a day, early in the morning
30 3 * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super TestOutboundEmail > /dev/null 2>&1
30 4 * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super CurrencyRatesUpdate > /dev/null 2>&1
30 5 * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super ClearSentNotificationsEmail > /dev/null 2>&1

# run these on saturday morning
35 2 * * 6 cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super ImportCleanup > /dev/null 2>&1
35 3 * * 6 cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super ExportCleanup > /dev/null 2>&1
35 4 * * 6 cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super CheckZurmoUpdates > /dev/null 2>&1
35 5 * * 6 cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super JobLogCleanup > /dev/null 2>&1

 



#2 raysto

raysto

    Zurmo Team

  • Administrators
  • 1,973 posts

Posted 20 March 2013 - 01:20 AM

Excellent! Thank you for this. I like to use the word "efficient" instead of lazy. So this is good for setting up Cron for an "efficient" person :)


Ray Stoeckicht
Zurmo Team
Try Zurmo Pro


#3 zendevel

zendevel

    Member

  • New Members
  • PipPip
  • 15 posts

Posted 01 May 2013 - 09:13 PM

This saved me a ton of time! Thank you. May I suggest including this in the Wiki? currently the Wiki is incomplete in this area.



#4 benovic

benovic

    Advanced Member

  • Members
  • PipPipPip
  • 60 posts

Posted 02 May 2013 - 10:01 AM

Update:

I added the new cron schedules that came in Zurmo 1.5, and set shell and path because without it, it caused problems.

 

# *    *    *    *    *  command to be executed
# -    -    -    -    -
# ¦    ¦    ¦    ¦    ¦
# ¦    ¦    ¦    ¦    ¦
# ¦    ¦    ¦    ¦    +----- day of week (0 - 7) (0 or 7 are Sunday, or use names)
# ¦    ¦    ¦    +---------- month (1 - 12)
# ¦    ¦    +--------------- day of month (1 - 31)
# ¦    +-------------------- hour (0 - 23)
# +------------------------- min (0 - 59)

#
# Set PATH, otherwise restart-scripts won't find start-stop-daemon
#
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

#run these every minute
* * * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super EmailArchiving > /dev/null 2>&1
* * * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super ProcessOutboundEmail > /dev/null 2>&1

#run these every 2 minutes
*/2 * * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super Export > /dev/null 2>&1

# run these every 5 Minutes
0,5,10,15,20,25,30,35,40,45,50,55 * * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super Monitor > /dev/null 2>&1

# run these every 15 Minutes
1,16,31,46 * * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super AutoresponderMessageInQueue > /dev/null 2>&1
2,17,32,47 * * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super ByTimeWorkflowInQueue > /dev/null 2>&1

# run these every 30 minutes
0,30 * * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super AddressGeocodeUpdate > /dev/null 2>&1

# run these every hour
5 * * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super AutoresponderMessageInQueue > /dev/null 2>&1

#run these once a day, early in the morning
30 3 * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super TestOutboundEmail > /dev/null 2>&1
30 4 * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super CurrencyRatesUpdate > /dev/null 2>&1
30 5 * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super ClearSentNotificationsEmail > /dev/null 2>&1
30 6 * * * cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super WorkflowValidityCheck > /dev/null 2>&1

# run these on saturday morning
35 2 * * 6 cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super ImportCleanup > /dev/null 2>&1
35 3 * * 6 cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super ExportCleanup > /dev/null 2>&1
35 4 * * 6 cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super CheckZurmoUpdates > /dev/null 2>&1
35 5 * * 6 cd /PATH/TO/YOUR/ZURMO/INSTALLATION/app/protected/commands; ./zurmoc jobManager  super JobLogCleanup > /dev/null 2>&1





#5 raysto

raysto

    Zurmo Team

  • Administrators
  • 1,973 posts

Posted 08 May 2013 - 06:29 PM

Hi Benovic, we added your cron file to our Job Manager wiki: http://zurmo.org/wik...-up-job-manager. If you like, I can give the credit to you for that portion of the wiki.
Thanks, Ray


Ray Stoeckicht
Zurmo Team
Try Zurmo Pro


#6 gacott

gacott

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 22 August 2013 - 01:28 PM

This is awesome . . . except is't just not working for me. I have the file in there but the crons are not working. I am on debian.7.0. Any help would be VERY greatly appreciated.

 

G



#7 dscherer

dscherer

    Advanced Member

  • Members
  • PipPipPip
  • 56 posts
  • LocationPittsburg, PA

Posted 22 August 2013 - 05:45 PM

The CRON file posted by the OP is for Version 1.5, Zurmo is now at Version 2.0.x, much of this seems to have changed.

 

Below is a CRON file that works on CentOS 6.3 using Vixie CRON. This *should* work fine with minimal modification for most *Nix systems.

 

The file assumes Zurmo is installed in /var/www/html/zurmo, be sure you change this as needed to reflect your Zurmo install path.

 

This CRON file contains all valid options as of Zurmo 2.0.22. All options are configured per the Job Manager recommendations section inside Zurmo. I've added intervals where I felt they were applicable. You may want to change these intervals, or disable certain jobs, depending on your specific needs.

 

To setup, simply type crontab -e at the shell and paste the contents there, press Ctrl+C then :wq to save it (crontab -e uses vi/vim editor by default).

 

If you loathe vi/vim you can create a new file called "zurmo.crontab" and type:

 

$ crontab zurmo.crontab

 

This will install the commands to your crontab file. Be sure you edit before running the command if edits are necessary (see above) otherwise the jobs will fail.

 

# *    *    *    *    *  command to be executed
# -    -    -    -    -
# ¦    ¦    ¦    ¦    ¦
# ¦    ¦    ¦    ¦    ¦
# ¦    ¦    ¦    ¦    +----- day of week (0 - 7) (0 or 7 are Sunday, or use names)
# ¦    ¦    ¦    +---------- month (1 - 12)
# ¦    ¦    +--------------- day of month (1 - 31)
# ¦    +-------------------- hour (0 - 23)
# +------------------------- min (0 - 59)

#
# Set PATH, otherwise restart-scripts won't find start-stop-daemon
#
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

#Every Minute
* * * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super ProcessOutboundEmail &> /dev/null

#Every 2 Minutes
*/2 * * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super Export &> /dev/null

#Every 5 Minutes
*/5 * * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super Monitor &> /dev/null
*/5 * * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super EmailArchiving &> /dev/null
*/5 * * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super EmailBounce &> /dev/null

#Every 15 Minutes
*/15 * * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super ByTimeWorkflowInQueue &> /dev/null
*/15 * * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super WorkflowMessageInQueue &> /dev/null

#Every 30 Minutes
*/30 * * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super AddressGeocodeUpdate &> /dev/null

#Every Hour (10 Minute Inervals)
0 * * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super AutoresponderQueueMessagesInOutbox &> /dev/null
10 * * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super CampaignGenerageDueCampaignItems &> /dev/null
20 * * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super CampaignMarkCompleted &> /dev/null
30 * * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super CampaignQueueMessagesInOutbox &> /dev/null

#Once a Day, Morning (Half-hour intervals)
30 3 * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super CearSentNotificationsEmail &> /dev/null
0 4 * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super TestOutboundEmail &> /dev/null
30 4 * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super WorkflowValidityCheck &> /dev/null
0 5 * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super JobLogCleanup &> /dev/null
30 5 * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super CurrencyRatesUpdate &> /dev/null

#Saturday Morning
30 3 * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super ExportCleanup &> /dev/null
30 4 * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super ImportCleanup &> /dev/null
30 5 * * * cd /var/www/html/zurmo/app/protected/commands && ./zurmoc jobManager super CheckZurmoUpdates &> /dev/null

 

Edit: The "Process By Time Workflows" line (ran every 15 minutes) was mistyped.



#8 Stafford

Stafford

    Zurmo Member

  • Moderators
  • 212 posts

Posted 27 August 2013 - 02:20 PM

Can you join us today at 10AM CST (15:00 UTC) for our weekly dev learning session? Our lead engineer can help you out live.http://zurmo.org/for...arning-session/


#9 kpowr82

kpowr82

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 08 November 2013 - 01:31 AM

Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/stkviper/public_html/app/protected/core/components/WebApplication.php on line 175

When running the ProcessOutboundEmail job I encounter this error

 

I have verified my PHP version is 5.3.27.  When I upgrade to 5.4 I get the same error.  I've seen elsewhere this error means I have the wrong PHP version however I pass the PHP version test when I run Zurmo system diagnostics.

 

Can anyone help?

 

 



#10 Burke

Burke

    Advanced Member

  • Members
  • PipPipPip
  • 40 posts
  • LocationLawrenceville, GA

Posted 16 February 2015 - 05:59 PM

here is an updated version of the file above, Corrected for a few job name typos and missing jobs relative to V 2.8.6

 

reminder to change paths to match your system/install

 

# *    *    *    *    *  command to be executed
# -    -    -    -    -
# ¦    ¦    ¦    ¦    ¦
# ¦    ¦    ¦    ¦    ¦
# ¦    ¦    ¦    ¦    +----- day of week (0 - 7) (0 or 7 are Sunday, or use names)
# ¦    ¦    ¦    +---------- month (1 - 12)
# ¦    ¦    +--------------- day of month (1 - 31)
# ¦    +-------------------- hour (0 - 23)
# +------------------------- min (0 - 59)
 
#
# Set PATH, otherwise restart-scripts won't find start-stop-daemon
#
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 
#Every Minute
* * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super ProcessOutboundEmail &> /dev/null
 
#Every 2 Minutes
*/2 * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super Export &> /dev/null
 
#Every 5 Minutes
*/5 * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super Monitor &> /dev/null
*/5 * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super EmailArchiving &> /dev/null
*/5 * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super EmailBounce &> /dev/null
 
#Every 10 Minutes
*/10 * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super ReadPermissionSubscriptionUpdate &> /dev/null
 
#Every 15 Minutes
*/15 * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super ByTimeWorkflowInQueue &> /dev/null
*/15 * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super WorkflowMessageInQueue &> /dev/null
 
#Every 30 Minutes
*/30 * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super AddressGeocodeUpdate &> /dev/null
 
#Every Hour (10 Minute Inervals)
0 * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super AutoresponderQueueMessagesInOutbox &> /dev/null
10 * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super CampaignGenerateDueCampaignItems &> /dev/null
20 * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super CampaignMarkCompleted &> /dev/null
30 * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super CampaignQueueMessagesInOutbox &> /dev/null
40 * * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super UpdateModelsLatestActivityDateTimeByMeeting &> /dev/null
 
#Once a Day, Morning (Half-hour intervals)
30 3 * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super ClearSentNotificationsEmail &> /dev/null
0  4 * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super TestOutboundEmail &> /dev/null
30 4 * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super WorkflowValidityCheck &> /dev/null
0  5 * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super JobLogCleanup &> /dev/null
30 5 * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super CurrencyRatesUpdate &> /dev/null
 
#Saturday Morning
30 3 * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super ExportCleanup &> /dev/null
30 4 * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super ImportCleanup &> /dev/null
30 5 * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super CheckZurmoUpdates &> /dev/null
30 6 * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super ShortUrlCleanup &> /dev/null
30 7 * * * cd /var/www/zurmo/app/protected/commands && ./zurmoc jobManager super DraftEmailTemplateCleanup  &> /dev/null


#11 Guest_mikecox_*

Guest_mikecox_*
  • Guests

Posted 02 April 2015 - 03:05 PM

Most of this makes perfect sense to me, but I don't understand the PATH part:

 

# Set PATH, otherwise restart-scripts won't find start-stop-daemon
#
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 
I don't understand Linux enough to know what that path is supposed to mean.  My server is Ubuntu using Bitnami.  The path to zurmo is /opt/bitnami/apps/zurmo/.  How do I know what SHELL should be and what PATH should be in my crontab file?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users