Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
03-28-2006, 08:39 AM
|
#1
|
|
Member
Registered: Dec 2001
Location: Beckwith Township, Ontario, Canada
Distribution: Slackware 13.0
Posts: 110
Rep:
|
bash script works when interactive, endless loop when started via cron
Hi,
I use the following within a homebrew backup script to loop until a tape has been loaded:
Code:
while [ `mt-st -f /dev/nst0 status | grep -c "ONLINE"` != 1 ]; do
sleep 30m
done
Works like a charm when the script is run manually in a terminal. When started via cron however, the loop condition is never met. I can verify that the tape drive is online from an independent session, yet every 30 minutes a new instance of sleep is spawned instead of the script carrying on.
What am I missing?
-d.
|
|
|
|
03-28-2006, 09:04 AM
|
#2
|
|
Member
Registered: Feb 2006
Location: Vietnam
Distribution: FC , RH , SuSE
Posts: 106
Rep:
|
What is your cron command to run your script ? Perhaps the time arguments cause your problem : they conflict with 30m on your script .
|
|
|
|
03-28-2006, 09:14 AM
|
#3
|
|
Member
Registered: Dec 2001
Location: Beckwith Township, Ontario, Canada
Distribution: Slackware 13.0
Posts: 110
Original Poster
Rep:
|
cron is set to run the script once a week, by simply invoking the name of the script with a fully-qualified path, without any stdout/stderr redirection.
|
|
|
|
04-01-2006, 07:05 AM
|
#4
|
|
Member
Registered: Dec 2001
Location: Beckwith Township, Ontario, Canada
Distribution: Slackware 13.0
Posts: 110
Original Poster
Rep:
|
Still looking for ideas...
|
|
|
|
04-01-2006, 01:53 PM
|
#5
|
|
Senior Member
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 13.37
Posts: 4,084
Rep: 
|
Have you tried it with the full paths to mt-st and grep? If your cron uses a different path to your shell account it may not find the commands and the code in the backticks will never return a '1'.
|
|
|
|
04-10-2006, 11:39 AM
|
#6
|
|
Member
Registered: Dec 2001
Location: Beckwith Township, Ontario, Canada
Distribution: Slackware 13.0
Posts: 110
Original Poster
Rep:
|
Quote:
|
Originally Posted by gilead
Have you tried it with the full paths to mt-st and grep?
|
Thanks for the suggestion!
Unfortunately however, using full path references didn't change a thing. 
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 03:24 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|