473,406 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 9571
numberwhun
3,509 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

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

Similar topics

16
by: Yang Li Ke | last post by:
Hi there, I have a php script which creates a .html gallery with thumbs and links etc.. I would like it to update the gallery and change the thumbs according to some random values every 60...
3
by: Frank R. Suchy | last post by:
Hi, I want a php-script to maintain (some of) "my" cron jobs. Therefore it has to modify some crontab.txt (no problem) and has to execute crontab. But since php runs as the apache-user it...
3
by: rbt | last post by:
How can I safely append a crontab entry to a crontab file progammatically with Python? I need to handle crontabs that currently have entries and crontabs that are empty. Also, I'd like this to...
3
by: dburdick | last post by:
I was referred to this forum as this may be a php specific problem. Some kind of configuration problem maybe. I have some php files that connect to a mysql database and are run as cron jobs. ...
5
by: sat | last post by:
Hi, I'm working as a DB2 UDB DBA. I have some questions regarding SCP command... Actually every week redirect restore takes place from one of my production servers to test servers.. So, but...
2
by: martijn | last post by:
H! I have made a program that is checking if a program is running or not. If the program is not running then it must start the program again. in the /etc/crontab: * * * * ...
4
by: Paul Lautman | last post by:
I have a simple script that has been running as a cron job for about 2 years. Recently my hosting company moved to new servers and now the job does not run. They have said that "The server...
7
by: aniljindal1983 | last post by:
i just want to do chmod on a file my_file but for that we must be su root. and finally that script will run through crontab ========================= #!/bin/ksh PASSWORD="pass123" echo...
7
by: Samuel A. Falvo II | last post by:
I have a shell script script.sh that launches a Java process in the background using the &-operator, like so: #!/bin/bash java ... arguments here ... & In my Python code, I want to invoke...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.