By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,330 Members | 1,135 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,330 IT Pros & Developers. It's quick & easy.

How can i run the shell script using Crontab ?

P: 38
Hi ,

I am want to run the shell script to run every 10 minutes of interval ,so that i have used crontab command for scheduling the shell script .. it cant works . i have checked wall command in crontab it is working properly when i try to run the shell script or even echo " name" cant to be worked using crontab.

can you please help me out for this problem?
Jan 29 '09 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 2.5K+
P: 3,503
Sure, we can help you, but we really need to see your crontab entry to be able to help you. Can you please post it here (enclosed in code tags) so we can see what you have tred?

Also, have you read the crontab man page? Its pretty helpful. To do that you want to use the following command:

Expand|Select|Wrap|Line Numbers
  1. man -s 5 crontab
Jan 29 '09 #2

P: 38
Thanks for reply.

i have attached sample file what i have used for crontab scheduling.

file -1 :(
results of following command output is shown after crontab scheduling
echo `hostname`
echo `hostname -i`

File -2 :
Scheduling file

* * * * * bash /home/project/

when i gave wall(command) " some comments" in file alone, it works, but i gave other that like echo or shell script it wont show any result in command prompt or output, i have also checked /var/log/cron file it shows the error like this
Jan 29 10:22:59 system1 CROND[6521]: (root) CMD (bash /home/project/
Jan 29 10:22:59 system1 CROND[6521]: LAuS error - do_command.c:226 - laus_attach: (19) laus_attach: No such device

can u suggest something about this problem.
Jan 29 '09 #3

Expert 100+
P: 542
when you use echo, I suggest to redirect the output to some file...
echo "hi" &> /home/ash/a.txt
see what it gives inside a.txt...

The reason is cron runs in backgroud...I think it is not attached with any tty console...Or may be puts stdout in some other file..
For safe side we always redirect output of scripts to our files..

PS: Don't forget to restart cron service....

Jan 29 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.