473,672 Members | 3,241 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can i run the shell script using Crontab ?

38 New Member
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 9592
numberwhun
3,509 Recognized Expert Moderator Specialist
@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
xtremebass
38 New Member
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:22 6 - laus_attach: (19) laus_attach: No such device



can u suggest something about this problem.
Jan 29 '09 #3
ashitpro
542 Recognized Expert Contributor
@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
8765
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 minutes Anyone can suggest me a way to do that?
3
5360
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 cannot run "my" crontab. In general: Can a php-script run an external program under a different
3
5394
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 work across Linux and BSD systems. Any pointers?
3
2580
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. The scripts work fine when run via the command line as root, but when run via the cron they cause a mysql connection error. Call to undefined function: mysql_pconnect()
5
6324
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 before i can restore it on the test server i need to transfer the backup file from the production server... So i want use the SCP command to do that... since it takes place on every wednesday early morning i would like run the scp command using...
2
3875
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: * * * * * root /usr/sbin/ program_prgchk in the /usr/sbin/program_prgchk:
4
1561
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 configuration is newer and your script will not run as it's a PHP file which contains some HTML." By this I think they mean that there is some HTML output outside the <?php ?braces.
7
70989
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 $PASSWORD>su root chmod 777 my_file ========================= I want to login as supervisor and then want to change the rights of the file before moving. but all has to be done through shell script which will be called through cron only
7
6229
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 this shell script using the Subprocess module. Here is my code: def resultFromRunning_(command):
0
8419
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8846
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8643
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8697
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7475
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4242
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4439
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2837
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1837
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.