4.3. Setting up the Scheduler

With ReportServer you can schedule reports and distribute the result either using mail, directly into a TeamSpace, or sent to a SFTP/FTP/FTPS server, among others (check datasink documentation for more details). The next section discusses important settings.

4.3.1. Mail Server Configuration
Note that the old /fileserver/etc/mail/mail.cf configuration file is deprecated. Please use email SMTP datasinks instead together with the default email datasink configuration.

In order for ReportServer to be able to send mails you must specify the mail server settings. Make the following configurations in your Email SMTP datasink.

Setting up the SMTP server. Replace the values host, port, username, and password according to your SMTP server.

Host: mail.yourmailserver.com
Port: 25
Username: rs@yourmailserver.com
Password: passwordsecret
SSL: false
TLS enable: false
TLS require: false

If you are using SSL or TLS please also specify these values. Next, configure the sender name, email address and forceSender options. If the forceSender option is set to true, the emails will be sent using the given (generic) sender details. If set to false, the specific user sending the email will determine the sender details.

Sender: rs@yourmailserver.com
Sender name: ReportServer
Force sender: false
Encryption policy: allow_mixed

The encryption policy option controls whether or not mails have to be encrypted or whether it is ok to send mails unencrypted if a user's public key is not specified. Choose between strict and allow_mixed. Note that if you choose strict then mails to users that do not have public key registered with ReportServer will not receive any messages.

Details on setting the default email datasink can be found in Section 4.1.8.

4.3.2. Scheduler settings

ReportServer comes with a powerful scheduler. ReportServer's scheduler allows you to schedule the execution of reports. The executed report can then either be emailed, stored in a folder in a TeamSpace, or sent to a FTP server.

The schedule and report recipients are user provided on scheduling. You can configure the messages that ReportServer will send out on certain events. Each message can be customized to your specifications.

ReportServer will send out the following emails:

  • email with attached completed report (mailaction) (deprecated, use fileactionEmailDatasink instead),
  • email if a report has been placed into a TeamSpace (fileaction),
  • email if a report has been sent to an email SMTP server (fileactionEmailDatasink),
  • email if a report has been sent to a SFTP server (fileactionSftp),
  • email if a report has been sent to a FTPS server (fileactionSftp),
  • email if a report has been sent to a FTP server (fileactionFtp),
  • email if a report has been sent to a Samba - SMB/CIFS server (fileactionSamba),
  • email if a report has been sent to a SCP (SSH) server (fileactionScp),
  • email if a report has been sent to the local filesystem (fileactionLocalFilesystem),
  • email on schedule (notification - scheduled),
  • email if a schedule job is revoked (notification - unscheduled),
  • email if a scheduled job failed (notification - failed)

The following configurations are done in the file /fileserver/etc/scheduler/scheduler.cf. To include information such as "the user who created the schedule entry", "the report's name" etc. in your message you can use a variety of expressions. Substitutions are defined in the ReportServer formula language. You will find further information about the ReportServer formula language in the Administrator's, as well as in the User Guide.

4.3.3. Available Substitutions
Expression Description
${job.getName()} job's name
${job.getDescription()} job's description
${job.getId()} job's ID
${report.getName()} report's name
${report.getDescription()} report's description
${report.report.getKey()} report's key
${report.getId()} report's ID
${user.getUsername()} username
${user.getFirstname()} first name of user
${user.getLastname()} last name of user
${user.getEmail()} user's email address
${user.getTitle()} user's title
${user.getId()} id of user
${executor} job's executor. You can use the same methods above as with user
${scheduledBy} job's scheduler. You can use the same methods above as with user
${teamspace.getName()} name of TeamSpace (only available in fileaction)
${folder.getName()} name of folder in TeamSpace (only available in fileaction)
${folder} name of folder in FTP server (only available in fileactionFtp)
${message} the message that was specified by the user on scheduling
${subject} the subject that was specified by the user on scheduling
${recipients} A list of the job recipients. Please check below for the exact configuration (list of users)
${owners} A list of the job owners. Please check below for the exact configuration (list of users)
${filename} filename as specified by the user (report is scheduled in teamspace)
${nextDates} date of next execution
${RS_CURRENT_DATE} current date
${errMsg} error message on erroneous execution
${stacktrace} detailed stacktrace on failed execution
List of users

For substitution of a list of users (currently supported: list of job recipients and list of job owners), you can use a fluent API that allows you to configure the output exactly as you need. Available methods for this are:

${withSeparator()} use a given separator between users. Default is a new line.
${addString('','')} add a String, e.g. a comma
${addBlankspace()} add a blank space
${addNewline()} add a new line
${addUsernames()} add usernames
${addFirstnames()} add first names
${addLastnames()} add last names
${addEmails()} add emails
${addTitles()} add titles
${addIds()} user ids
${print()} create the result string. This method has to be called in the last place.

As mentioned, you can use a fluent API for configuring the output. E.g.,

${recipients
      .addFirstnames()
      .addBlankspace()
      .addLastnames()
      .addBlankspace()
      .addString("(")
      .addUsernames()
      .addString(")")
      .print()
 }

will print the following:

Barry Jones (bjones)

Diane Murphy (dmurphy)

Gerard Hernandez (ghernande)

Larry Bott (lbott)

If you want to separate the users by a comma instead of a new line, you can enter use the withSeparator() method as follows:

${recipients
      .withSeparator(", ")
      .addFirstnames()
      .addBlankspace()
      .addLastnames()
      .addBlankspace()
      .addString("(")
      .addUsernames()
      .addString(")")
      .print()
 }

which will print the following data:

Barry Jones (bjones), Diane Murphy (dmurphy), Gerard Hernandez (ghernande), Larry Bott (lbott)

Below you can find some example configurations:

Configuration of email message with attached report (successful execution)

	<mailaction html="false">
	<subject>${subject}</subject>
	<text>Text of message: ${message}</text>
	<attachment>
		<name>rep-${report.getName()}-${RS_CURRENT_DATE}</name>
	</attachment>
	</mailaction>

Configuration on successful execution of report and storage in TeamSpace

	<fileaction disabled="false" html="false">
	    <subject></subject>
	    <text></text>
	</xmlcode>

Configuration on successful execution of report sent to email SMTP server

	<fileactionEmailDatasink disabled="false" html="false">
	    <subject></subject>
	    <text></text>
	</fileactionEmailDatasink>

Configuration on successful execution of report and storage in SFTP server

	<fileactionSftp disabled="false" html="false">
	    <subject></subject>
	    <text></text>
	</fileactionSftp>

Configuration on successful execution of report and storage in FTPS server

	<fileactionFtps disabled="false" html="false">
	    <subject></subject>
	    <text></text>
	</fileactionFtps>

Configuration on successful execution of report and storage in FTP server

	<fileactionFtp disabled="false" html="false">
	    <subject></subject>
	    <text></text>
	</fileactionFtp>

Configuration on successful execution of report and storage in Samba server

	<fileactionSamba disabled="false" html="false">
	    <subject></subject>
	    <text></text>
	</fileactionSamba>

Configuration on successful execution of report and storage in SCP (SSH) server

	<fileactionScp disabled="false" html="false">
	    <subject></subject>
	    <text></text>
	</fileactionScp>

Configuration on successful execution of report and storage in the local filesystem

	<fileactionLocalFilesystem disabled="false" html="false">
	    <subject></subject>
	    <text></text>
	</fileactionLocalFilesystem>

Configuration on successful execution of report and storage in Dropbox

	<fileactionDropbox disabled="false" html="false">
	    <subject></subject>
	    <text></text>
	</fileactionDropbox>

Configuration on successful execution of report and storage in OneDrive - SharePoint (O365)

	<fileactionOneDrive disabled="false" html="false">
	    <subject></subject>
	    <text></text>
	</fileactionOneDrive>

Configuration of notifications on scheduling, unscheduling and execution errors

	<notification disabled="false" html="false">
	<scheduled>
		<subject></subject>
	<text></text>
	</scheduled>
	<unscheduled>
		<subject></subject>
	<text></text>
	</unscheduled>
	<failed>
		<subject></subject>
	<text></text>
	</failed>
	</notification>

If you would like to send emails in the HTML format please set the corresponding html attribute to "true".

In case you do not want to have one or more notifications, you can disable the individual notifications using the disabled attribute:

<fileaction disabled="true" html="false">

If you do not want to use the scheduler you can disable it using

	<properties>
		<disabled>true</disabled>
	</properties>

You can also disable the scheduler by setting the following property in your reportserver.properties file:

rs.scheduler.disable = true

If the property is set both in reportserver.properties and in /fileserver/etc/scheduler/scheduler.cf, the property set in reportserver.properties is taken into account, while the one set in /fileserver/etc/scheduler/scheduler.cf is ignored.

Keep in mind that this changes will only take effect after reboot. To enable or disable the scheduler while ReportServer is running, use the terminal command scheduler daemon start/stop. This command only works if the scheduler is not disabled in the file reportserver.properties. If it is, you first have to delete this property in order to be able to enable/disable the scheduler while ReportServer is running. Refer to the Administration Guide for more information on this command.

Further, refer to Section 4.9. Scheduler Settings for more scheduler settings.