Welcome to the most active Linux Forum on the web.
Go Back > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.


  Search this Thread
Old 08-13-2008, 11:59 PM   #1
LQ Newbie
Registered: Aug 2008
Posts: 25

Rep: Reputation: 15
script not running in cronjob

set zar=0
set tot=0
for tot in 0
while read i
cd /opt/audible/logs/cdl/$i
d=`date|cut -d' ' -f1,2,3`
e=`date|cut -d' ' -f4|cut -d':' -f1`
f="$d $e:00"
zar=`cat aws_dynamic_partial.log |grep "${f}"|cut -d' ' -f14 | tr -s ',' ' '`
tot=`expr $tot + $zar`
echo $tot > /home/dingale/file
done < serverlist.txt
echo no of c programms running are $tot|mailx -s "No of c programmes running are $tot"

This script runs fine when fired manually
but gives blank value when run as cronjob.

Ingale D. N.
Old 08-14-2008, 01:27 AM   #2
LQ Newbie
Registered: Apr 2003
Location: Philippines
Distribution: Slackware
Posts: 19

Rep: Reputation: 0
You're not specifying the all important magic header in scripts that tell your shell what interpreter will be running the script.

In this case, your script seems to be a sh/bash like script so you need to insert the following to very 1st line:
Old 08-14-2008, 01:27 AM   #3
Registered: Jun 2006
Location: Johannesburg, South Africa
Distribution: Ubuntu, CentOS, Debian
Posts: 47

Rep: Reputation: 15
When run as a cronjob you need to ensure the paths are found in your script. The safest way to do this is to always specify the full path for each utility (eg /bin/grep instead of just grep)

Try this in your script and see if it helps?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
script expression not running in cronjob dningale Solaris / OpenSolaris 2 08-13-2008 01:04 AM
sftp script via cronjob ?? OzTEXS Linux - Security 21 12-28-2006 04:38 PM
Cronjob / script question nazs Linux - General 1 12-21-2006 02:45 PM
cronjob php script MrSako Linux - General 1 08-27-2006 08:30 PM
cronjob not working but script works dtra Linux - Newbie 4 02-28-2005 06:05 PM > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 07:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration