Oh no!! crazy script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Oh no!! crazy script
# 1  
Old 07-29-2005
Oh no!! crazy script

Hi

Could be stupid, but I can figure out... I have a script that downloads a file from a http server ( virus definitions file ). The thing is that when I run it from the console (bash) works fine, but when I put it in the root's cron it doesn't, and it generates a core file.

example:

server:#/my/script/script.sh <----- works ok. as root

crontab -e (as root)

00 15 * * * /my/script/script.sh <----- doesn't work.

Someone ask me if the script begins with the magic number line, and in fact it does.

vi script.sh

#!/usr/local/bin/bash

If you can help me, I'll send postal from Buenos Aires, Argentina to you. ;-)
Thanks!!!
# 2  
Old 07-29-2005
have you check your cron logs ?, what exactly means 'doesn't work'?
# 3  
Old 07-29-2005
sorry, even if the cron runs the script, the script doesn't do what is expected.
Thats the weird thing about it, the script runs fine if I executed from the command line. also Im pretty sure that the cron runs the script 'cause, as you suggest, I already checked the /var/cron/log file.

I think is something related with the environment. When I run the script from the comman line, there are some settings like PATH, LD_LIBRARY and so on, that are loaded when I log on as root; but is seems that those setting are missing when the script is called from the cron.

I also cheked the /etc/default/cron to add the PATH, but still doesn't work.

I hope its a bit more clear. Thanks for your help.
# 4  
Old 07-29-2005
can you show your cron output, logs?
# 5  
Old 07-29-2005
make sure you put some environment variables on your crontab i.e...
Code:
#
SHELL=/bin/sh
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
HOME=/var/log
#
#minute hour    mday    month   wday    who     command
#
#*/5    *       *       *       *       root    /usr/libexec/atrun
#

maybe your script will run without any problems...
# 6  
Old 07-29-2005
Well, it's Solaris 2.6. I think you cannot put lines in the cron file other than
min-hour-day-etc and the script you want to run.
I believe those line goes in a file called /etc/default/cron, and I already put those lines without success.

The log from the cron is not much help, as the only thing that shows is the line executing the script:

> CMD: /my/script/script.sh
> root 22762 c Wed Jul 27 17:00:00 2005

and then continues with other lines from other jobs.

By the way, I tried to put the PATH with "crontab -e" and it gaves me:

"crontab: error on previous line; unexpected character found in line."
"crontab: errors detected in input, no crontab file generated."

Thanks.
# 7  
Old 07-29-2005
what the crontab man page says about its syntax ?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Crazy Syntax

Hello All, was looking at a script wrote by someone and when I try and run it in ksh it gives me an error. Could ksh version be a problem or is there something wrong that I'm missing, when I run it from the command line it works. Thanks! results=`sudo -u admin ssh... (1 Reply)
Discussion started by: akechnie
1 Replies

2. What is on Your Mind?

Here's To The Crazy One

Please excuse my indulgence. Thank you MG Siegler and Steve Jurvetson. But most importantly, thank you Steve Jobs. 8rwsuXHA7RA The world has lost a genius. (1 Reply)
Discussion started by: Scott
1 Replies

3. Homework & Coursework Questions

Crazy Dots

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Create a script called DOTS that will display the horizontal or vertical number of dots if the first argument... (3 Replies)
Discussion started by: pchelpmtl
3 Replies

4. Shell Programming and Scripting

Finger has gone crazy

Two things : On the first place i am really desperate, on the second i am about to throw my laptop away to the recycle bin in a while. Ok now that i expressed my feeling let me describe you this mad situation. Code: print $1; ("finger -m " $1 "| head -1") | getline userinfo print... (6 Replies)
Discussion started by: beatblaster666
6 Replies

5. Shell Programming and Scripting

Linux script - Crazy results

Here is my script: # # Capture the current directory. export -p CurrentDir="`pwd`" echo $CurrentDir # # Capture the new directory name in the form YYYYMMDD. export -p DateDir="`date +"%Y%m%d"`" echo $DateDir # # Store the desired target directory. export -p... (6 Replies)
Discussion started by: imprimisxo
6 Replies

6. Shell Programming and Scripting

grep -E drives me crazy

Hi there, I'm new here. I registered my self today with this board because I hope to get some help before I'll become a slavering maniac. I'm really desperate, since I'm trying for hours(really!) to let grep search a pattern that goes about 2 lines. The pattern is as follows: Handle... (6 Replies)
Discussion started by: darkelf
6 Replies

7. What is on Your Mind?

crazy dreams..

well, Wine is simply amazing.. I love it. the filesystems are great too -- never having to defragment, and not slowing down in time. I love the power of BASH. iptables.. but.. I had a vision. a crazy dream. what if, we could develop an installation system for Linux.. working pretty much... (3 Replies)
Discussion started by: ialoq
3 Replies

8. Shell Programming and Scripting

PERL cgi script... extra character driving me crazy

I'm using a PERL cgi script that uses rrdtool to make graphs. I can't get the syntax correct to use a degree sign (alt+0176 like this °) and also using a variable. If I use single quotes, I can't call the variable. If I use double quotes, there is an extra symbol (Â) before the ° which goes... (2 Replies)
Discussion started by: audiophile
2 Replies

9. Shell Programming and Scripting

ftp going crazy

Dear Friends, I am having a crazy issue with ftp. I am doing 'mput' of 4 files (z1, z2, z3, z4) as below. But ftp transfers only every alternative file !! - ie; If I do mput z* for above, it sends only z1 and z3. Note that all the files are same and I tried this for several dummy files. All... (3 Replies)
Discussion started by: yoursdivu
3 Replies

10. Shell Programming and Scripting

going crazy with test???

oK, i know for sure that code = Y and var = N but no matter what this always prints ignore, never valid??????? if test "$code"="$var" ... (2 Replies)
Discussion started by: mich_elle00
2 Replies
Login or Register to Ask a Question