Make entries in crontab file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Make entries in crontab file
# 1  
Old 06-07-2012
Make entries in crontab file

I have created a shell script "abcd.sh" and script should run after every 10 min., For that I will create below entry in the crontab file by using command crontab -e
Code:
*/10 * * * * /cdr/work/proc_raw/abcd.sh >> /dev/null 2>&1

I wish to know whether above entry is correct or I have to make entry as:
Code:
*/10 * * * * /cdr/work/proc_raw/sh abcd.sh >> /dev/null 2>&1

I have to deploy script in production and no test environment is available so I wish to clear my doubt before deployment.

Operating System: HP Linux
Shell: bash

when I run the shell script in command prompt, I have to run the script as sh abcd.sh
If I run the script as in command prompt as abcd.sh, it throws error as
bash: abcd.sh: command not found

Last edited by Franklin52; 06-07-2012 at 08:38 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 06-07-2012
have you added the first line to tell which shell you are running? like
Code:
#!/bin/sh

This User Gave Thanks to donadarsh For This Post:
# 3  
Old 06-07-2012
The first crontab line on post #1 is the correct one.

Make sure that the script is executable.
Make sure that the script has shebang line (like in post #2) pointing to the absolute path of bash or sh (depending on which is appropriate). In your intro you refer to bash, but in the example to sh. Maybe they are actually the same Shell on your computer?


Quote:
If I run the script as in command prompt as abcd.sh, it throws error as
bash: abcd.sh: command not found
That is just because the directory containing the script is not in $PATH .
What is important is whether it runs as:
Code:
/cdr/work/proc_raw/abcd.sh

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

How to list all crontab entries?

Hi, 1. How can I list all the crontab entries of all system users (like root, adm, sys etc.) as we have multiple files like /etc/crontab , /var/spool/cron, /etc/cron.d, /etc/cron.daily, /etc/cron.hourly, /etc/cron.monthly etc. 2. How can I list all the crontab entries of ALL users on a... (1 Reply)
Discussion started by: prvnrk
1 Replies

2. UNIX for Dummies Questions & Answers

How to change crontab entries?

How to edit crontab entries . A job is scheduled as 35 15 * * * it.sh rahul_raj/hdhd i want to change it as 45 15 * * * it.sh rahul_raj/hdhd 1.crontab -e 2.shift+g ---go to last line .press enter.Press <i> . After this what should i do? (6 Replies)
Discussion started by: rafa_fed2
6 Replies

3. Shell Programming and Scripting

Crontab - how to make time range?

im puting script in crontab, script is executing every 15min, every day, every monath but i must make time range from 0:00 - 20:00 <> 20:30 - 0:00 or if i cant make 20:30 then 0:00 - 20:00 <> 21:00- 0:00 can i make it in single line like this? 7,22,37,52 0-23 * * * test.sh >/dev/null... (3 Replies)
Discussion started by: waso
3 Replies

4. Programming

makeutility: how to get the make-file name inside of the make-file?

How I can get the current make-file name in a make-file So, if I run make with specified file:make -f target.mak is it possible to have the 'target' inside of the that 'target.mak' from the file name? (2 Replies)
Discussion started by: alex_5161
2 Replies

5. Solaris

Duplicate crontab entries

hi guys. can someone tell me what will happen if there are two identical crontab entry for an application. For example 03 23 * * 1 /usr/vt/crondemo 03 23 * * 1 /usr/vt/crondemo will the file crondemo run twice, once or wont run at all?? (2 Replies)
Discussion started by: vikashtulsiyan
2 Replies

6. Shell Programming and Scripting

how to change crontab entries

Hi Friends, I need to change crontab entries in prod. $crontab -l -> using this i can see the entries only Plese tell me how to edit this crontab and how to change the entires Waiting for ...... Thanks In advance friends Krish. (2 Replies)
Discussion started by: kittusri9
2 Replies

7. Shell Programming and Scripting

script to extract crontab entries

Hi, I am wondering if anyone has got a script to extract information such as frequnecy, date, time, file, log file etc. from crontab and put in a csv or similar format. Thanks Raj (5 Replies)
Discussion started by: raj@au
5 Replies

8. Solaris

problem to make a crontab -l

Hello everyone, this is the first i write in the forum, hope i can help , but now i have a problem There must be something wrong in my machine. I installed ( years ago ) an application (NEP) and when I try to show the backup scheduled in crontab the systems says i have no privilegies to do... (4 Replies)
Discussion started by: javierg
4 Replies

9. Solaris

which file is updated after modified the crontab entries.

Hi all, i want to know which file is updated after changes the modifications/new entries in crontab. Please help regarding this. regards Krishna (1 Reply)
Discussion started by: krishna176
1 Replies

10. UNIX for Advanced & Expert Users

crontab entries deleted !!

Hi all, A friend of mine accidently erased all crontab entries by typing crontab -r. Can anyone pls. help me on this. Is it possible that a backup file is available other than files from the backup tape. Or is it retrievable ??? Thnx, MK (6 Replies)
Discussion started by: minazk
6 Replies
Login or Register to Ask a Question