Если Вашим CSV является простой CSV без заключения в кавычки механизма (следовательно, запятые не могут появиться в поле), можно сделать парсинг в оболочке.
{
read line # ignore the header line
IFS=,
while read -r name age address; do
./mycommand --name="$name" --age="$age" --address="$address"
done
}
Если поля могут быть заключены в кавычки, Вам нужен реальный синтаксический анализатор CSV. Используйте Perl, Python, R, Ruby или другие языки.
Существует два метода к обработке этой ситуации. Идеальный путь при наличии logrotate уведомляет процесс, или через сигнал или путем перезапуска процесса через postrotate
директива. Другой путь использует copytruncate
. copytruncate
метод должен работать в Вашей ситуации. Вот описание из документации:
copytruncate
Truncate the original log file in place after creating a copy,
instead of moving the old log file and optionally creating a new
one, It can be used when some program can not be told to close
its logfile and thus might continue writing (appending) to the
previous log file forever. Note that there is a very small time
slice between copying the file and truncating it, so some log-
ging data might be lost. When this option is used, the create
option will have no effect, as the old log file stays in place.
Как насчет обходного решения к вхождению в системный журнал?
Посмотрите использование --daemon [progname]
(или --syslog [progname]
) в man openvpn
(http://openvpn.net/index.php/open-source/documentation/manuals/65-openvpn-20x-manpage.html)