[rrd-users] Re: Simple shell script nor working properly

Darryl Lewis Lewis.Darryl at abc.net.au
Thu Sep 7 02:29:39 MEST 2006


When a program is run from cron, it doesn't have any of your environment settings. Basically, it doesn't know where the program is, or what directory it should be working in.
If you add

#! /bin/sh

cd /home/{user}/{directory}

it should work.
note that you should replace {user} and {directory} with the correct path. You can get this by typing pwd and put that in the cd line.

Darryl

-----Original Message-----
From: rrd-users-bounce at list.ee.ethz.ch
[mailto:rrd-users-bounce at list.ee.ethz.ch]On Behalf Of VladoPortos
Sent: Thursday, 7 September 2006 2:07 AM
To: rrd-users at list.ee.ethz.ch
Subject: [rrd-users] Simple shell script nor working properly


I learning rddtools and done simple shell script, it works fine when i 
runn it form shell but when i put it to runn as cron job it want put 
data in db :(

here is the script:

#! /bin/sh

#---------------------------------------------#
TIMESTAMP=`date +%s`;
ZACIATOK=$(($TIMESTAMP-10));
KONIEC=$(($TIMESTAMP+86400));
DATABAZA=/home/test.rrd
OBRAZOK=/home/test.png #---------------------------------------------#

if [ ! -s $DATABAZA ] ; then
rrdtool create --step 60 $DATABAZA DS:teplota:GAUGE:600:0:150 
RRA:AVERAGE:0.5:1:60
fi

t=`sensors |grep Temp1 | cut -d"+" -f2|cut -d"." -f1`

rrdtool update test.rrd $TIMESTAMP:$t

rrdtool graph $OBRAZOK -a PNG --title="Teplora (Denne, v 5 Minutovom 
priemer)" -v "Teplota (Stupne Celsia)" --width=600 --height=300 
--upper-limit=150 --low$

echo $TIMESTAMP:$t


i cant get it to work in cron :( please help....

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi


==============================================================================
The information contained in this email and any attachment is confidential and
may contain legally privileged or copyright material.   It is intended only for
the use of the addressee(s).  If you are not the intended recipient of this
email, you are not permitted to disseminate, distribute or copy this email or
any attachments.  If you have received this message in error, please notify the
sender immediately and delete this email from your system.  The ABC does not
represent or warrant that this transmission is secure or virus free.   Before
opening any attachment you should check for viruses.  The ABC's liability is
limited to resupplying any email and attachments
==============================================================================

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list