Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG  Not logged in ELOG logo
icon5.gif   calculate the value of one attribute depending upon the value of other attribute., posted by dev on Thu Jan 22 17:27:47 2015 
    icon2.gif   Re: calculate the value of one attribute depending upon the value of other attribute., posted by Andreas Luedeke on Mon Jan 26 15:56:41 2015 
       icon2.gif   Re: calculate the value of one attribute depending upon the value of other attribute., posted by dev on Mon Jan 26 19:24:02 2015 
          icon2.gif   Re: calculate the value of one attribute depending upon the value of other attribute., posted by Andreas Luedeke on Tue Jan 27 15:59:59 2015 
             icon2.gif   Re: calculate the value of one attribute depending upon the value of other attribute., posted by dev on Tue Jan 27 17:18:17 2015 
                icon2.gif   Re: calculate the value of one attribute depending upon the value of other attribute., posted by Andreas Luedeke on Wed Jan 28 09:57:11 2015 
Message ID: 67768     Entry time: Mon Jan 26 19:24:02 2015     In reply to: 67767     Reply to this: 67770
Icon: Reply  Author: dev  Author Email: joshi868b@gmail.com 
Category: Question  OS: All  ELOG Version: 3.3 
Subject: Re: calculate the value of one attribute depending upon the value of other attribute. 

I tried that It is not calculating  and it is giving the error "Shell execution not enabled via -x flag ".I started elogd -x from command prompt  it still gives the same error.

Andreas Luedeke wrote:

If you have the following elogd.cfg:

Attributes = START, END, DURATION
subst DURATION = $shell( /usr/local/elog/diff.sh \"$START\" \"$END\")
Show Attributes Edit = START, END

And the shell script /usr/local/elog/diff.sh is:

#!/bin/sh
s1=$(date -d "$1" +%s)
s2=$(date -d "$2" +%s)
d=$(echo "($s2-$s1)/3600"|bc -lq)
printf "%.0f hours" $d

Then DURATION is calculated from START and END in full hours.

It appears that if you define START and END as "datetime", then only the date part would be passed to the script. This may is a bug of elogd: Stefan, have you ever tried?

dev wrote:

I HAVE A LOGBOOK WHICH KEEPS THE RECORD OF ALL FAULT BOOKED BY DIFFERENT SUBSCRIBER.THIS LOGBOOK HAS THREE ATTRIBUTE DOWNTIME,UPTIME & TOTAL DURATION (DATE &TIME FORMAT) . I WANT TO CALCULATE THE TOTAL DURATION AUTOMATICALLY WHENEVR UPTIME VALUE IS GIVEN AND IF THE UPTIME IS NOT GIVEN IT SHOULD CALCULATE DEPENDING UPON THE SYSTEM PRESENT TIME.PLEAS EXPLAIN IT WITH EXAMPLE.

PS: Please do NOT write all capital text in a forum. Thank you!

 

ELOG V3.1.5-3fb85fa6