1826604 Members
3632 Online
109695 Solutions
New Discussion

Re: Cron script error

 
SOLVED
Go to solution
TKeller
Frequent Advisor

Cron script error

Greetings again. Disclaimer: I've searched on here to find anything similar and wasn't able to. Cron works fine, cron daemon is alive and well, and from all intents and purposes, all cron job scripts are good.

On startup of the machine (rp4440, 11.11), when /etc/rc.config.d directory is sourced (minus backups, etc), the /etc/rc.config.d/cron file returns the following (set -x is on):

+ . cron
sh: Syntax error: `(' is not expected.

If I'm in that directory and I do 'cp cron foo' and run the same command, it works just fine. All this file is doing is starting cron if the value is 1 or ignoring cron if it's 0. Nothing else. Question is, why would it report a script error?

The only thing I can think of is that the shell knows it's sourcing a system file and reads something else, something that's shell-based and hence, it reports said error.

Thanks all in advance!

It is said you should treat your body like a temple. I treat mine like an amusement park.
6 REPLIES 6
Phillip Thayer
Esteemed Contributor

Re: Cron script error

Can you post the /etc/rc.config.d/cron file here. It looks to me like you have an extra character (`)in the script that shouldn't be there. Possibly when you were editing the file in vi and went to hit the esc key you hit the wrong key at one time or another.

Phil
Once it's in production it's all bugs after that.
TKeller
Frequent Advisor

Re: Cron script error

#!/sbin/sh
# @(#)B.11.11_LR
# Cron configuration. See cron(1m)
#
# CRON: Set to 1 to start cron daemon
#
CRON=1


There's the /etc/rc.config.d/cron file. I thought that too, but what confuses me is that if I copy that file to say 'foo' and then I source it with '. foo', it returns nothing.
It is said you should treat your body like a temple. I treat mine like an amusement park.
Sandman!
Honored Contributor

Re: Cron script error

how about sourcing with the full pathname i.e.

. /etc/rc.config.d/cron
James R. Ferguson
Acclaimed Contributor
Solution

Re: Cron script error

Hi:

I suspect that the actual error is not in the 'cron' configuration file but the predecessor file.

Try:

# sh -vx /etc/rc.config 2>&1 | more

...and examine the output.

Regards!

...JRF...

TKeller
Frequent Advisor

Re: Cron script error

Sandman: that worked, as it didn't return any error.

James R. Ferguson: you're absolutely right...thanks! It was find a file called 'pre-mirrorvg00' that passed the filename filter and had mirror info, including illegal characters like (). Don't know how or why that's there, but it's gone now!

Thanks all, very good help!
It is said you should treat your body like a temple. I treat mine like an amusement park.
TKeller
Frequent Advisor

Re: Cron script error

Another file was causing cron to falsely show as failing.
It is said you should treat your body like a temple. I treat mine like an amusement park.