Scheduling a script by using Crontab


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Scheduling a script by using Crontab
# 8  
Old 02-17-2011
scheduling a script by using crontab

Thanx for ur post Rd

pwd is /home/cnu...then ls -l showing pgm..

But ls -l /home/cnu/pgm.sh is showing ..............

ls: cannot access /home/cnu/pgm.sh: No such file or directory

What can i do............ can u explain me how crontab runs for perticular pgm r file...plzzzzzzzzzz

Many Thanks in advance
Rds,
Sree vasu
# 9  
Old 02-20-2011
I think you need to read up on the "crontab" command.
Your Systems Administrator needs to allow you account to use the "crontab" command. By default no account except the "root" account can use the "crontab" command.
As an overview, the scheduling line(s) are held in a file in strict "crontab" format and then published with the "crontab" command.
Judging from the error message you posted, you are typing the scheduling line at the command prompt. This is not the correct method.
# 10  
Old 02-20-2011
Thanx Methy,

Can u tell me the correct method step by step How to scheduling a script using Crontab.

Many Thanks In Advance,
Sree Vasu

---------- Post updated at 04:34 AM ---------- Previous update was at 03:42 AM ----------

YA under /home/cnu
file is there but still i am getting this errror...
# 11  
Old 02-20-2011
Quote:
Originally Posted by sree vasu
plzzzzzzzzzz
Zzzzzzzz is a character sequence-symbol recognized as sleeping.
Lazy is associated with sleeping.
Even without that clue, your post is a recognized symbol of laziness.

There are plenty of good tutorials in the net, so many in fact, that even a search impaired person would have no trouble at all, hitting results.
# 12  
Old 02-22-2011
I have some problem which is related to this thread,
I have a script which should be executed on last day of every month.
for which I am using the following crontab command.

Code:
 
30 00 * * * [ `/usr/bin/date +%d` -eq `echo \`/usr/bin/cal\`|/usr/bin/awk '{print $NF - 6}'` ] && /usr/bin/sh /infiles/tmp.sh

when I execute the following at command prompt , it executes fine

Code:
 
[ `/usr/bin/date +%d` -eq `echo \`/usr/bin/cal\`|/usr/bin/awk '{print $NF - 6}'` ] && /usr/bin/sh /infiles/tmp.sh

But when I schedule the same in the crontab It is throwing the following error after executing the cronjob.

Code:
 
Your "cron" job executed on dev on Tue Feb 22 00:21:00 CST 2011
[ `date +%d` -eq `echo `cal` | awk '{print $NF - 6}'` ] && sh /infiles/tmp.sh
 
produced the following output:
sh: 0403-057 Syntax error at line 1 : `|' is not expected.

Thanks,
Sekhar.
# 13  
Old 02-22-2011
@sekhar gajjala
Your main problem is caused by the "%" sign in the crontab line which has special meaning to cron (it becomes a newline unless escaped). See "man crontab".
It will be easier to read if you place the commands in a script and then execute the script from cron.

Ps. Please open a new thread in future.
This User Gave Thanks to methyl For This Post:
# 14  
Old 02-23-2011
Thanks Methyl.
It worked when I embeded my command in a script and then scheduled the script.

Thanks,
Sekhar.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Scheduling a script

Hi, I have my script in below path in UNIX /storage/sas_source/SDTM-Development/FileWatcher/filewatcher.sh I want to schedule it to run every 30 secs. Please let me know the steps to do it. Thanks. (7 Replies)
Discussion started by: prats_7678
7 Replies

2. Shell Programming and Scripting

Crontab Scheduling

I want to schedule a job as - Every Weekday at 12:30 PM and 9 PM in a single line. How can i do that (2 Replies)
Discussion started by: varlax
2 Replies

3. UNIX for Dummies Questions & Answers

[Solved] crontab scheduling

Hi, We can schedule a new job using crontab -e. is there any other way to achieve the same(opening the file directly and add an entry). I have tried to access /var/spool/crontabs directory. But i am getting permission denied error, Please help me. Thanks (8 Replies)
Discussion started by: pandeesh
8 Replies

4. Shell Programming and Scripting

Scheduling a Ksh script

All, Running the below script independently is working fine with no issue but once I am scheduling it in cron on my Linux environment it is not working. Can anyone look into this and let me know what I have to modify here to schedule it properly. 09 03 * * 4 ksh 'cd... (1 Reply)
Discussion started by: Oracle_User
1 Replies

5. Shell Programming and Scripting

Crontab scheduling

Hi all, My OS is Solaris 10. I want to schedule a job which i need to run between morining 6 to eve 6 once for every 2 hours. This is what i did. 0 6-18 * * 1-5 /monitor.sh It runs for every hour how to make it for every two hours ...... Thanks, Firestar. (1 Reply)
Discussion started by: firestar
1 Replies

6. UNIX for Advanced & Expert Users

Scheduling a script other than crontab

Hi, How can we run/schedule a shell script. Since there is no access to cron at this point of time we have to think other way out to run a script every hour. How can we achieve this. Need advice. How about using sleep,autosys etc...the script should trigger off every hour...which sends... (3 Replies)
Discussion started by: noorm
3 Replies

7. Shell Programming and Scripting

Shell script for scheduling

Hi guys, I am new guy for unix. I need help writing the following shell script. My requirement is: I have few pl/sql procedures(lets say 10). I want to run some of them (say 5) parallally in the background and once these are completed trigger the next ones one after other. Could some one... (13 Replies)
Discussion started by: chanduhyd4u
13 Replies

8. Shell Programming and Scripting

Scheduling crontab using parameter from XML file

Hi, I need to write script which will read a value from XML file and schedule crontab accordingly. I have an XML file which has a key value structure where the entries is: <Param Name="executionInterval" Value="600" /> 600 means that the crontab should be scheduled to run every 600 sec. ... (0 Replies)
Discussion started by: michaelbz
0 Replies

9. Shell Programming and Scripting

script scheduling

Hi, I have a ksh scrip (x) that scans a directory and does actions when a file arrives in this directory. My question is what is the best way to schedule x? 1. Use cron tab and create a task running forever 2. Creat another ksh script (y) that runs (x) in a non-terminating loop Which... (2 Replies)
Discussion started by: GNMIKE
2 Replies

10. Shell Programming and Scripting

scheduling script to run another script on Solaris

Hi everyone, I am trying to automate one process on Solaris OS. This is what happens at the moment. Every night at 19:30 and every hour after that we run a script that checks the status of databases. That script runs and prints if db's are OK at the end it states how many were down. I am... (3 Replies)
Discussion started by: andrei
3 Replies
Login or Register to Ask a Question