简体   繁体   中英

Scheduling jobs in Linux using crontab

I am using Linux Centos to schedule a job. I have created a shell script file called Im_daily_loads.sh to run the job at 12:42PM everyday.

with the following comands:

#!/bin/sh
42 12 * * * cd $pdi; ./kitchen.sh -file="/opt/kff/software/pdi/5.0.1.A/data-  integration/projects/IML/code/stg/IML_Load_Frm_SRC_To_PSA.kjb" -level=Basic >  -logfile="/opt/kff/software/pdi/5.0.1.A/data-integration/projects/IML/log/iml_daily_loads.err.log"

Then loaded the file into crontab by using the issuing the following command crontab Im_daily_loads.sh, but my job is not running.

What would be the problem?

Why not just use

crontab -e

as the user you plan to execute the job as, enter the job, save and exit the editor?

Also, it looks like you need to define $pdi in your script. How is crontab supposed to know where your script is located?

first , run a very simple job to be shure crontab works at all.

for example

          • set > /tmp/crontab_works.log 2>&1

it will write down all variables. so you will see not all variables available in crontab

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM