Skip to content

Command Line CmisSync

Nicolas Raoul edited this page Apr 7, 2017 · 17 revisions

CmisSync can be run without the graphical user interface.

Usage

Usage: CmisSync.Console.exe

CmisSync.Console.exe synchronizes all configured folders once, then exits.

You can also choose to only synchronize one (or more) particular synchronized folder(s):

CmisSync.Console.exe ProjectA
CmisSync.Console.exe ProjectA ProjectB

The identifiers can be found in your config.xml file.

The log file is the same as the normal CmisSync application, which is usually: C:\Users\nico\AppData\Roaming\cmissync\debug_log.txt (replace nico with the name of the user under which CmisSync.Console.exe is being run).

Automation

If you want to synchronize every 5 minutes, for instance, please call CmisSync.Console.exe from a scheduling software like cron on Linux/Mac or Scheduled Tasks on Windows.

CmisSync.Console.exe returns a exit code:

  • 0 if synchronization was successful or not needed,
  • 1 if synchronization failed, or could not run.

You can use that exit code in a script to trigger different actions, for instance send an alert.

Configuration

To configure new synchronized folders, you can either:

  • Start the normal CmisSync GUI and use the Add Synchronized Folder wizard
  • Use the wizard on another computer and copy the XML file (you will need to edit the password)
  • Write the XML C:\Users\nico\AppData\Roaming\cmissync\config.xml from scratch, here is a sample (replace nico with your user name):
<?xml version="1.0" encoding="utf-8"?>
<CmisSync xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <configSchemaVersion>1</configSchemaVersion>
  <notifications>true</notifications>
  <singleRepository>false</singleRepository>
  <frozenConfiguration>false</frozenConfiguration>
  <log4net>
    <appender name="CmisSyncFileAppender" type="log4net.Appender.RollingFileAppender">
      <file value="C:\Users\nico\AppData\Roaming\cmissync\debug_log.txt" />
      <appendToFile value="true" />
      <rollingStyle value="Size" />
      <maxSizeRollBackups value="5" />
      <maximumFileSize value="1MB" />
      <staticLogFileName value="true" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
      </layout>
    </appender>
    <root>
      <level value="DEBUG" />
      <appender-ref ref="CmisSyncFileAppender" />
    </root>
  </log4net>
  <folders>
    <folder>
      <name>ProjectA</name>
      <path>C:\Users\nico\CmisSync\ProjectA</path>
      <url>http://server:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom</url>
      <repository>-default-</repository>
      <remoteFolder>/Sites/ProjectA/documentLibrary</remoteFolder>
      <user>theuser</user>
      <password>thepassword</password>
      <issuspended>false</issuspended>
      <syncatstartup>true</syncatstartup>
      <pollinterval>5000</pollinterval>
    </folder>
    <folder>
      <name>ProjectB</name>
      <path>C:\Users\nico\CmisSync\ProjectB</path>
      <url>http://server:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom</url>
      <repository>-default-</repository>
      <remoteFolder>/Sites/ProjectB/documentLibrary</remoteFolder>
      <user>theuser</user>
      <password>thepassword</password>
      <issuspended>false</issuspended>
      <syncatstartup>true</syncatstartup>
      <pollinterval>5000</pollinterval>
    </folder>
  </folders>
</CmisSync>

For the last two methods, you must create the local folder (for instance C:\Users\nico\CmisSync\ProjectA) of each <folder> block manually before starting for the first time.