Reference

dialdcost(1)

calculate cost of dial on demand connection

NAME

dialdcost - calculate cost of dial on demand connection

SYNOPSIS

dialdcost [-sfctuhv] [--scratch] [--file=PATH] [--cost=VALUE] [--unit=UNIT] [--time=START:END] [--verbose] [--help] [--version]

DESCRIPTION

dialdcost Calculate and display cost for a connection made with the DIALD program.

All given files are parsed in turn, and each given cost and unit applied to that file to calculate the cost.

If no options are given, then the default log file is read and the cost calculated from default values. The program will display the return value, in a form that could easily be grabbed by a script. The value will be formatted according to locale, as specified in the wg15 locale data.

OPTIONS

-s, --scratch

Scratches any setup that has been done by setup files, or command line parameters, and uses the built-in values. Which are 60 seconds per Unit, and one cent unit cost.

-f, --file

Parses the file given by PATH and calculates the the cost of connections logged in the file, with the cost and unit it knows to this point.

-u, --unit

Set the units for each cost to UNIT seconds. This value will be the global value used in any subsequent calculations.

-c, --cost

Set the cost for each unit to COST dollars or cents :-) As with --unit This will set the global value used in any subsequent calculations.

-t, --time

Set a time period to calculate the cost. The cost for the period is the current global cost, with the current global unit. The period is given as Hours:Minutes:Seconds and a hyphen used to seperate start and end time of the period.

A period can wrap over midnight 18:00-08:00 will map time from 6 pm to 8 am.

Oh, yes... a 24 hour time format is used.

--verbose

This option will make the program display a discriptory text along with the calculated value. The total duration will also be displayed as hours, minutes and seconds.

-v, --version

This will display a short version information, GNU style, and then exit the program. No calculations are done.

-h, --help

Display a short information describing the command line options available and exit without doing any calculations.

It is possible to define these options in a file, that is either global for the site or in the users home directory. They are read in turn, the users file ~/.diald-cost.conf first, and if that one doesn't exit the global configuration is tried /etc/diald-cost.conf if neither produce possible options, then built-in values are used.

The configuration file, has a couple of keywords, these are

EXCLUDE <day>

Excludes the <day> which is on the form Sun..Sat from the time period calculations. This is to enable rush hour definitions during weekdays and then make a global definiton for cost outside this time.

TIME <start-end>

As with the command line option, this gives the start and end time for a cost period.

FILE <path>

As with the command line option, this is the default file to be used with calculations.

FIFO <path>

Tell the program, that the fifo channel to diald is in <path>. If the default path to the fifo channel doesn't comply with the local installation this command can be used to tell of the local location.

COST <cost>

The cost, this cost has the same format as in command line option. This is a floating point value.

UNIT <unit>

The unit, in the same format as in the command line option.

If you wanted to define the cost as 3 cents per minute, during rush hour 9-5, and then 1 cent per minute outside that time. And you wanted to have Saturdays and Sundays defined as an exclusion to the rush hour definition. The file could look like this:

FILE /var/log/diald.log;
EXCLUDE Sat;
EXCLUDE Sun;
UNIT 60;
COST 0.3;
TIME 09:00-17:00;
COST 0.1;

Please note as well, that the program is locale specific. If your own formatting of floating values, uses a floating comma instead of the floating point. You must enter floating point values, as '0,1' in the above. The same applies to the display of floating point values, they will be displayed in the locale format. Given that you have WG15 locale definition installed, of course.

BUGS

Probably many, but non reported yet.

TODO

Add option to make the calculation refer to site. Add ability to exclude Dec 25th.

AUTHOR

dialdcost Was written in 1997, by Ørn E. Hansen to provide a simple command to calculate the connection cost by dial on demand connections, with DIALD.

FILES

/var/log/diald.log      - The default log file
/etc/diald-cost.conf    - Site global specifications file
~/.diald-cost.conf      - Specifications file in users home directory 

SEE ALSO

diald(8)

History

--downlink since Debian 2.0 (Hamm); --uplink since Debian 2.0 (Hamm).

-B until Debian 1.3 (Bo).