473,372 Members | 924 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,372 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 9566
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.