Page History
Table of Contents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
Introduction
- Cron is a
...
Code Block |
---|
*/30 * * * * /path_to_file/file.sh >> /path_to_file/file.log 2>&1
|
We assume that this file is located in /tmp/my_crontab.
The migration has two steps:
Step 1: Calling ./bin/cronconverter.sh
In the first step you call ./bin/cronconverter.sh.
This creates an xml file with all jobs.
This script is used as follows:
Code Block |
---|
usage: cronconverter [-changeuser <command>] [-createJobChains
<true|false>] [-createMock <true|false>] -crontab <file> [-systab <0|1>]
-target <file> [-v <level>]
-changeuser <command> change user command for -systab=1. 'su'
or 'sudo' or define your own command using $SCHEDULER_CRONTAB_USER.
-createJobChains <true|false> set to true if you want to create
jobChains and jobs
-createMock <true|false> set to true if script has to be mok'ed
-crontab <file> crontab file
-systab <0|1> set to 1 if source is the system crontab
(with user field)
-target <file> xml configuration file
-v <level> loglevel [0=info] [1=debug1]...[9=debug]
|
You can create Standalone-Jobs or Order-Jobs including a Job Chain and an Order for each cron job.
Please create a target folder for the conversion (e.g. ./cron) and call the converter.
1. Standalone-Jobs
Code Block |
---|
./bin/cronconverter.sh -crontab /tmp/my_crontab -target cron/cronconvert_result.xml
|
2. Order Jobs with Job Chain and Order (recommended)
Code Block |
---|
./bin/cronconverter.sh -crontab /tmp/my_crontab -createJobChains true -target cron/cronconvert_result.xml
|
This creates the file cron/cronconvert_result.xml that contains all Jobs, Job Chains and Orders for further transformation (see step 2).
Step 2: Calling ./config/xml2live.xsl
Code Block |
---|
java -jar lib/saxon9he.jar -s:"cron/cronconvert_result.xml" -xsl:"config/xml2live.xsl" sos.destination="cron/live"
|
This call creates a directory ./cron/live/GlobalCollect/ that contains the JobScheduler objects (Jobs, Job Chains, Orders).
The folder has subdirectories corresponding to the paths of the cron jobs.
In our example you should get
- ./cron/live/GlobalCollect/path_to_file/file.sh.job.xml
when you have called the cronconverter without -createJobChains or otherwise - ./cron/live/GlobalCollect/path_to_file/file.sh.job.xml
- ./cron/live/GlobalCollect/path_to_file/file.sh.job_chain.xml
- ./cron/live/GlobalCollect/path_to_file/file.sh,file_sh.order.xml
with the following content:
./cron/live/GlobalCollect/path_to_file/file.sh.job.xml (Standalone-Job)
...
- service daemon available with most Unix operating systems.
- Cron offers minimal scheduling capabilities by executing an operating system command or script at a given point in time.
- Cron jobs are configured from a
crontab
file that is globally available and that can be made available per operating system account. - Cron does not consider any job dependencies, job execution results, job history and resource consumption when executing jobs.
- Cron is frequently used as an entry level to job scheduling. The JS7 covers any capabilities available with Cron Jobs.
- Migration of Cron jobs is offered from the JS7 Configuration view with the Convert operation.
Crontab Migration
Let's assume a
crontab
file with the following content:Code Block
...
*/30 * * * * /path_to_file/file.sh
...
...
>> /path_to_file/file.log 2>&
...
1
...
./cron/live/GlobalCollect/path_to_file/file.sh.job.xml (Order Job)
Code Block |
---|
<?xml version="1.0" encoding="iso-8859-1"?>
<job order="yes" timeout="600" title="Cron Job /path_to_file/file.sh >> /path_to_file/file.log 2>&1">
<extensions>
<extension xmlns="www.sos-berlin.com/schema/joe">
<generator date="2013-02-21 11:46:18" name="CronConverter" vendor="www.sos-berlin.com">
<docu>*/30 * * * * /path_to_file/file.sh >> /path_to_file/file.log 2>&1</docu>
</generator>
<comment/>
</extension>
</extensions>
<script language="shell"><![CDATA[
echo created by CronConverter, at 2013-02-21 11:46:18
/path_to_file/file.sh >> /path_to_file/file.log 2>&1
]]></script>
</job>
|
./cron/live/GlobalCollect/path_to_file/file.sh.job_chain.xml
Code Block |
---|
<?xml version="1.0" encoding="iso-8859-1"?>
<job_chain>
<extensions>
<extension xmlns="www.sos-berlin.com/schema/joe">
<generator date="2013-02-21 11:46:18" name="CronConverter" vendor="www.sos-berlin.com">
<docu>*/30 * * * * /path_to_file/file.sh >> /path_to_file/file.log 2>&1</docu>
</generator>
<comment/>
</extension>
</extensions>
<job_chain_node error_state="error" job="file.sh" next_state="success" state="100"/>
<job_chain_node state="success"/>
<job_chain_node state="error"/>
</job_chain>
|
./cron/live/GlobalCollect/path_to_file/file.sh,file_sh.order.xml
Code Block |
---|
<?xml version="1.0" encoding="iso-8859-1"?>
<order title="GlobalCollect/path_to_file/file.sh">
<extensions>
<extension xmlns="www.sos-berlin.com/schema/joe">
<generator date="2013-02-21 11:46:18" name="CronConverter" vendor="www.sos-berlin.com">
<docu>*/30 * * * * /path_to_file/file.sh >> /path_to_file/file.log 2>&1</docu>
</generator>
<comment/>
</extension>
</extensions>
<run_time>
<period repeat="00:30"/>
</run_time>
</order>
|
Now you can copy the folder content of ./cron/live/GlobalCollect/* to ./config/live/.
...
- Let's further assume that this file is located in
/tmp/my_crontab
.
The migration to JS7 includes the following steps:
- TBD