UpdateController/load_tariff
2022-06-05 16:58:39 +02:00

34 lines
1.1 KiB
Bash
Executable File

#! /bin/bash -
# set -x
#
# echo "Usage: ./${0##*/} <tariff.config> <tariff.current>"
#
# tariff.config: a JSON-file representing the tariff which should be used
# (this tariff-file is generated by a web-based tool of
# Mobilisis)
# tariff.current: a file containing infos about the currently used tariff:
# VERSION: version of the tariff
# PROJECT: e.g. szeged
# ZONE: usually 1
# INFO: additional info for the tariff (optional)
# LOADED: date when tariff has been loaded
#
# This file will be used by the update_psa-script to send
# a message to ISMAS containing the current settings of the PSA.
#
if [ $# -eq 2 ]; then
if [ -f $1 ]; then
out="\"VERSION\":\"$(cat $1 | jq -r .version)\"",
out+="\"PROJECT\":\"$(cat $1 | jq -r .project)\"",
out+="\"ZONE\":$(cat $1 | jq -r .zone)",
out+="\"INFO\":\"$(cat $1 | jq -r .info)\"",
out+="\"LOADED\":\"$(date +%Y-%m-%dT%T)\""
echo $out > $2
exit $?
fi
fi
echo "Usage: ./${0##*/} <tariff.config> <tariff.current>"