Configuring Scheduled Publishing


The following documentation will allow system administrators the ability to run page, incremental, and full-site publishes on a schedule.  The schedule can be set up by using Windows Task Scheduler (Appendix B) or a cron job (Appendix C) with Linux.  This documentation outlines the steps to configure scheduled publishing with a few different configurations.

How to use:

  • Install Python 2.7 on the CM1 server and make sure that it can execute .py extensions.  The dependencies outlined in the script files require this version of Python
  • Install the Python library 'Requests' via the following URL: (please see Appendix A for further instructions on this)
  • Download the file
  • Open the script mentioned above and find the two variables "user" and "pwd."
    • Change these to the admin user name and password for your CM1 instance.
  • Create a .txt file (let's call it config1.txt) that will describe the incremental jobs you want to be executed at a specific time.
    • In the config1.txt file use the following format:
    • Type of publish (i, f, or p) for incremental, full, or a single-page publish, respectively
    • Site Name of the site you want to publish
    • Publishing Server Name (the name of the publishing definition in the Publish menu) of the site you want to publish






pageId (see Appendix D)

    • Note: the order that the sites or pages will be published is from top to bottom and all sites or pages are published sequentially each waiting for the other sites to finish.
  • To start the script ( you can execute it through terminal or by command line calling the script using the parameters "Config_File.txt" and Polling_Time (in seconds) along with an optional parameter Server_Name.  The polling time refers to the amount of time in which to check to see if the publishing job has completed.  If your site takes several hours, for example, you might set this time (in seconds) to equate to the number of hours it takes your site to publish.
    • Note: if you do not specify the parameter Server_Name it will default to "http://localhost:9992"
E.X. c:\Python27> Python.exe "config1.txt" 45
  • If you want to publish different sites at different times you must create multiple configuration files and set a task scheduler to run the script with different configuration files at different times. 
    • Note: Because publishing jobs are asynchronous there is a possibility of a site publishing later than expected if there is not enough time between two separate publishes.

Appendix A: Install Requests Library (Windows)

To install the 'requests' library using Python, navigate to your Python27 root directory.  From here, you will need to download the file at this address:

You may save the contents of that page to a file named ''  It's easiest to download this file to the Python27 root directory, and run:


From here, you can download this file to the same location:

Run the following command:


From here, you can navigate to C:\Python27\Scripts and run

pip.exe install requests

Appendix B: Configure Task Scheduler (Windows)

  • Open Task Scheduler on the CM1 server
  • Select 'Action --> Create Basic Task'
  • Give your task a name and description.  Click 'Next'
  • Select how often you'd like the task to run.  Click 'Next'
  • Select the time that you would like the task to run.  Click 'Next'
  • Select 'Start a program'
  • Under the 'Start a Program' dialog, add the following parameters:
    • Program/script: "C:\Python27\python.exe"
    • Add arguments (optional) "incremental.txt" 30
    • Start in (optional):C:\Python27
  • Verify that the configuration looks correct, and click 'Finish'
  • Once completed, edit the task's properties and and select 'General'
  • Select 'Run whether user is logged in or not' and 'Run with highest privileges'

Appendix C: Configuring a cron job (Linux)

  • First, it is recommend to create a simple .sh script file to reference from the cron job
  • Let's call this file, ''  This might look like:

#! /bin/bash
# Full Publish Script
cd /home/percussion/
python "full.txt" 30

  • This file will call the python program and pass in the parameters required to run the scheduled publish.  These are defined in the beginning of the document
  • This file will need to be made executable:
    • chmod +x
  • To test this file itself, you may run:
    • ./
    • Note: For the above configuration to work, all of the configuration files mentioned above need to be in the same directory, and Python must be added to your path
  • When you can successfully run the .sh file on its own, you may configure a cron job.  This can be done via:
    • crontab -e
    • Here, you may pass in parameters for your cron job.  A cron job must be defined in the format:
      • minute, hour, date, month, weekday, program_to_run
      • For example, a task to run the would look like: 

        44 13 8 * * /home/percussion/

      • This states that the script will be ran at 13:44 on the 8th of every month.

Appendix D: Finding a page's id

  • To find a page's id, you will need to open CM1 and right click the page in the Finder.  Select 'Inspect' or 'Inspect Element'
  • The page id will be a number that starts with 16777215-101-x, where x is the unique number of the page.  This is typically two lines above the default selection when inspecting the element
  • This entire number will need to be passed to the script.  In the case seen below, 16777215-101-707 would be passed to the script
  • Below is an attachment of what this will look like:

    Page Id in Developer Tools

Leave a comment