title | description | author | ms.author | ms.reviewer | ms.date | ms.service | ms.subservice | ms.topic | ms.custom | |
---|---|---|---|---|---|---|---|---|---|---|
Schedule SSIS packages on Linux with cron |
This article describes how to schedule SQL Server Integration Services (SSIS) packages on Linux with the cron service. |
lrtoyou1223 |
lle |
maghan, randolphwest |
08/23/2023 |
sql |
linux |
conceptual |
|
[!INCLUDE SQL Server - Linux]
When you run SQL Server Integration Services (SSIS) and [!INCLUDE ssnoversion-md] on Windows, you can automate the execution of SSIS packages by using [!INCLUDE ssnoversion-md] Agent. When you run [!INCLUDE ssnoversion-md] and SSIS on Linux, however, the [!INCLUDE ssnoversion-md] Agent utility isn't available to schedule jobs on Linux. Instead, you use the cron service, which is widely used on Linux platforms to automate package execution.
This article provides examples that show how to automate the execution of SSIS packages. The examples are written to run on Red Hat Enterprise. The code is similar for other Linux distributions, such as Ubuntu.
Before you use the cron service to run jobs, check to see whether it's running on your computer.
To check the status of the cron service, use the following command:
systemctl status crond.service
If the service isn't active (that is, it's not running), consult your administrator to set up and configure the cron service properly.
A cron job is a task that you can configure to run regularly at a specified interval. The job can be as simple as a command that you would normally type directly in the console or run as a shell script.
For easy management and maintenance purposes, we recommend that you put your package-execution commands in a script that contains a descriptive name.
Here is an example of a simple shell script for running a package. It contains only a single command, but you can add more commands as required.
# A simple shell script that contains a simple package execution command
# Script name: SSISpackageName.daily
/opt/ssis/bin/dtexec /F yourSSISpackageName.dtsx >> $HOME/tmp/out 2>&1
After you've defined your jobs, you can schedule them to run automatically by using the cron service.
To add your job for cron to run, add the job in the crontab file. To open the crontab file in an editor where you can add or update the job, use the following command:
crontab -e
To schedule the previously described job to run daily at 2:10 AM, add the following line to the crontab file:
# run <SSIS package name> at 2:10 AM every day
10 2 * * * $/HOME/SSIS/jobs/SSISpackageName.daily
Save the crontab file, and then quit the editor.
To understand the format of the sample command, review the information in the following section.
The following image shows the format description of the job line that's added to the crontab file.
:::image type="content" source="media/sql-server-linux-schedule-ssis-packages/ssis-linux-cron-job-definition.png" alt-text="Screenshot of the format description for a crontab file entry.":::
To get a more detailed description of the crontab file format, use the following command:
man 5 crontab
Here's a partial example of the output that helps to explain the example in this article:
:::image type="content" source="media/sql-server-linux-schedule-ssis-packages/ssis-linux-cron-crontab-format.png" alt-text="Screenshot of a detailed partial description of crontab format.":::