Oracle Solaris System Administration (MOSC)

MOSC Banner

Shell Script gives error when run through cron job.

edited Apr 21, 2011 1:26AM in Oracle Solaris System Administration (MOSC) 1 commentAnswered
 Hi,
The following shell script runs without any problem when executed manulally.

USED=$(df -h /arch | tail -1 | awk '{print $5}' | cut -d '%' -f 1)
if [ ${USED} -gt 90 ]
then
find /arch/AUBUAT/ -type f -mtime +0 | xargs rm
find /arch/AUBMIG/ -type f -mtime +0 | xargs rm
fi

But the same gives below error when called from a cron job:
/backup/arch_test.sh: syntax error at line 1: `USED=$' unexpected

We are running following version:
bash-3.00$ uname -a
SunOS uaeaubdbdr01.aub.af 5.10 Generic_141444-09 sun4u sparc SUNW,SPARC-Enterprise

Kindly assist.

Thanks

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center