469,909 Members | 1,617 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,909 developers. It's quick & easy.

How can i run the shell script using Crontab ?

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
3 9288
numberwhun
3,503 Expert Mod 2GB
@xtremebass
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
  2.  
Jan 29 '09 #2
Thanks for reply.

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

file -1 :(sysinfo.sh)
results of following command output is shown after crontab scheduling
<code>
echo `hostname`
echo `hostname -i`
</code>

File -2 :
Scheduling file cronfile.sh

<code>
* * * * * bash /home/project/sysinfo.sh
</code>

when i gave wall(command) " some comments" in sysinfo.sh 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/sysinfo.sh)
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
ashitpro
542 Expert 512MB
@xtremebass
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....

Regards,
Ash
Jan 29 '09 #4

Post your reply

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

Similar topics

16 posts views Thread by Yang Li Ke | last post: by
3 posts views Thread by Frank R. Suchy | last post: by
3 posts views Thread by rbt | last post: by
5 posts views Thread by sat | last post: by
4 posts views Thread by Paul Lautman | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.