Crontab Job Syntax


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Crontab Job Syntax
# 1  
Old 06-28-2013
Crontab Job Syntax

I have a ksh script that does the following



1. Script executes and creates an output file from a sql query
2. That output file is an input file to the script
3. generates an html file to email to DBA receipients

The following syntax works at the command line

Code:
/home/sybase/dbascripts/syb_bkup_rpt.ksh /home/sybase/dbascripts/input/bkup_rpt-qry.tx

t


The following crontab sybtax does not work

Code:
35 18 * * 0-6 /home/sybase/dbascripts/syb_bkup_rpt.ksh >/home/sybase/dbascripts/input/bkup_rpt_qry.txt 2>$1


How do I do the followinf

1. Ececute script 1 - syb_bkup_rpt.ksh which generates output file
bkup_rpt_qry.txt
2 Use output file bkup_rpt_qry.txt as input to script 1
3. log errors in another file

Example
Code:
syb_bkup_rpt.ksh bkup_rpt_qry.txt > bkup_rpt_err.log


Last edited by Don Cragun; 06-28-2013 at 09:30 PM.. Reason: Add CODE tags
# 2  
Old 06-28-2013
cronjob command line
Code:
/home/sybase/dbascripts/syb_bkup_rpt.ksh > /home/sybase/dbascripts/input/bkup_rpt_qry.txt 2> /dir/errlog

script
Code:
#! /usr/bin/ksh
script=$0
infile=/home/sybase/dbascripts/input/bkup_rpt_qry.txt

some_code
some_code
.....
.....
some_code
some_code

if [ -s $infile ]
then
       cat $infile | mailx -s "cronjob log entries for $script" admin@some.com
else
       "$script did not generate any entries."
fi

exit 0

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Crontab job is not working

hell all: i am trying to test a crontab job for snmpwalk but it is not working: here is crontab: */1 * * * * root /root/snmpwalk.sh for the script, it is very simple: #!/usr/local/bin/bash /usr/local/bin/snmpwalk -v 2c -c public 100.10.10.10 (6 Replies)
Discussion started by: ipfreak
6 Replies

2. SuSE

A crontab job not working

Hello, This is my first posting in Linux world. I have SLES 11. I've created a file 'packdisk-scandisk.txt' file under /var/opt/Teradata/bteqdba. The content of the file is, cat /var/opt/Teradata/bteqdba/packdisk-scandisk.txt output over /var/opt/Teradata/bteqdba/TAREAS_DBA.log... (2 Replies)
Discussion started by: JDBA
2 Replies

3. Shell Programming and Scripting

Crontab job scheduler problem

Dear All. I have a scripts which does many task like house keeping, moving file to different location and loading the data into oracle. I run this scripts daliy manually , I decided to put it into cron. I have put the scripts into crantab but the behaviour of the scripts have changed. it... (2 Replies)
Discussion started by: guddu_12
2 Replies

4. Shell Programming and Scripting

Problem with Job execution using crontab

Hi All, I am facing a problem with crontab.I made an entry in crontab like this 05 07 * * * /afs2/cdwfullacc/current/exe/cdw_generate_special_klant.sh > /afs2/cdwfullacc/current/scratch/cdw_gen_cron.log But job was not getting executed. Entry in crontab was made with same user by whom... (4 Replies)
Discussion started by: krishna_gnv
4 Replies

5. Shell Programming and Scripting

To Run a job every hour without using crontab

Hi, Can anyone help me in finding how to run a specific job every hour without using crontab. Say for example i need to run a command ps -aux in the starting of every hour.. (3 Replies)
Discussion started by: glv
3 Replies

6. Shell Programming and Scripting

Schedule a job using Crontab

I would like to execute my script at 17.30 and 23.00 using crontab, could anybody help me out!! Thanks in Advance!! (1 Reply)
Discussion started by: jatanig
1 Replies

7. UNIX for Dummies Questions & Answers

crontab job not running

Hi all, down here part of the scheduled job in crontab (AIX Version 5) i have problem running jspPRE-ALL. i verrify permissions and privileges (the others job are working good) if i run the job in command line it work correctly # # Aggiornamento doni e continuity 00 02 * * 2-6... (5 Replies)
Discussion started by: ilpasta
5 Replies

8. Shell Programming and Scripting

Help with a crontab job!!!

Hi, i need to schedule a script to run at 6.10AM everyday.I tried to do this way. #!bin/ksh 10 06 * * 0-6 sh /tmp/ss/script/daily_file_check.sh And at the command prompt I did >crontab -e cron.txt I'm not sure whether this is the right way. Can anyone please tell me how to... (4 Replies)
Discussion started by: kumarsaravana_s
4 Replies

9. UNIX for Dummies Questions & Answers

Crontab job queue

My cronjob triggers the script late by 6 minutes. /var/cron/log shows that it got triggered at the right time then where can I track, the late starting of the script. Is there some queue mechanism, some log? This happens sometimes, not daily. but it affects me, whenever it happens. Logging... (1 Reply)
Discussion started by: pksingh2
1 Replies

10. UNIX for Dummies Questions & Answers

crontab job

Hi, I have cornjob was scheduled at 1:00 AM everyday. It has been running fine since last Saturday. But it didn't run since Saturday. Because of daytime saving time change it didn't ran? Please send me your thoughts. Thanks in adavance. Moe (3 Replies)
Discussion started by: Moe
3 Replies
Login or Register to Ask a Question