Просмотр Исходного

h1. Выгрузка на СОРМ3

h2. Принцип работы

Для интеграции с СОРМ3 VasExperts требуется произвести первичную выгрузку данных, а так же добавить сценарии планировщика задач, которые будут выгружать добавленные и изменённые данные с определённой периодичностью: один раз в час.
Для автоматизации передачи отчетов на СОРМ3 сделайте следующее:

# Создайте папку *sorm3* и необходимые подпапки, в них будут храниться отчеты для выгрузки, а так же выгруженные файлы:
{code}
mkdir -p /app/asr_billing/cfg/sorm3/
mkdir -p /app/asr_billing/cfg/sorm3/conf/
mkdir -p /app/asr_billing/cfg/sorm3/data/
mkdir -p /app/asr_billing/cfg/sorm3/done/
mkdir -p /app/asr_billing/cfg/sorm3/Log/
{code}
# Создайте файл *ftp.conf* c данными для подключения к FTP-серверу СОРМ в директории */app/asr_billing/cfg/sorm3/conf/*. Пример содержимого файла */app/asr_billing/cfg/sorm3/conf/ftp.conf*:
{code}
ftpip=192.168.1.10
ftplogin=sorm
ftppass=sormpass
{code}
# Добавьте все отчеты, получающие данные из биллинга, а также скрипты для первоначальной выгрузки данных в папку */app/asr_billing/cfg/sorm3/*. Листинги отчетов и пути приведены далее в статье. Должна получиться следующая структура каталога:
{code}
/app/asr_billing/cfg/sorm3/conf
/app/asr_billing/cfg/sorm3/data
/app/asr_billing/cfg/sorm3/deleted_abonents.sh
/app/asr_billing/cfg/sorm3/deleted_abonents.sql
/app/asr_billing/cfg/sorm3/done
/app/asr_billing/cfg/sorm3/fixednetid.sql
/app/asr_billing/cfg/sorm3/fixednetid.sh
/app/asr_billing/cfg/sorm3/ip_numbering.sh
/app/asr_billing/cfg/sorm3/ip_numbering.sql
/app/asr_billing/cfg/sorm3/ip.sh
/app/asr_billing/cfg/sorm3/ip.sql
/app/asr_billing/cfg/sorm3/Log
/app/asr_billing/cfg/sorm3/payments-periodic.sql
/app/asr_billing/cfg/sorm3/payments.sh
/app/asr_billing/cfg/sorm3/payments.sql
/app/asr_billing/cfg/sorm3/service_list-periodic.sql
/app/asr_billing/cfg/sorm3/service_list.sh
/app/asr_billing/cfg/sorm3/service_list.sql
/app/asr_billing/cfg/sorm3/services-periodic.sql
/app/asr_billing/cfg/sorm3/services.sh
/app/asr_billing/cfg/sorm3/services.sql
/app/asr_billing/cfg/sorm3/subscribers_v2-periodic.sql
/app/asr_billing/cfg/sorm3/subscribers_v2.sh
/app/asr_billing/cfg/sorm3/subscribers_v2.sql
/app/asr_billing/cfg/sorm3/switches.sh
/app/asr_billing/cfg/sorm3/switches.sql
/app/asr_billing/cfg/sorm3/upload_all.sh
{code}
# Добавьте задания в планировщик задач и перезапустите его.
# Проведите первоначальное наполнение данными
h1. Скрипт для планировщика задач
Скрипт выгружает изменения по абонентам, услугам и платежам за последний час.
*/etc/cron.hourly/vasexperts_sorm_hourly.sh*
{code}
#/bin/bash

source /app/asr_billing/cfg/sorm3/conf/ftp.conf

LOGFILE=/app/asr_billing/mnt/var/cfg/sorm3/Log/abonents.log
file_date=$(date +%Y%m%d%H%M)
printf '\n\n' >> $LOGFILE 2>&1
date >> $LOGFILE 2>&1


chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/payments-periodic.sql | sed '/^$/d'| sed 's/ */ /g' | iconv -f cp1251 -t utf8 > /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt
if [ -f /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt ]
then
printf 'Метаданные файла\n' >> $LOGFILE 2>&1
ls -l /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt >> $LOGFILE 2>&1
printf 'Количество строк в файле: ' >> $LOGFILE 2>&1 && cat /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt | wc -l >> $LOGFILE 2>&1
cp /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt /app/asr_billing/cfg/sorm3/done/payments_v1_$file_date.txt
curl -v -sS --user $ftplogin:$ftppass -T /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt ftp://$ftpip/ISP/abonents/ >> $LOGFILE 2>&1
rm -rf /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt
fi


chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/services-periodic.sql | sed '/^$/d'| sed 's/ */ /g' > /app/asr_billing/cfg/sorm3/data/services_$file_date.txt
if [ -f /app/asr_billing/cfg/sorm3/data/services_$file_date.txt ]
then
printf 'Метаданные файла\n' >> $LOGFILE 2>&1
ls -l /app/asr_billing/cfg/sorm3/data/services_$file_date.txt >> $LOGFILE 2>&1
printf 'Количество строк в файле: ' >> $LOGFILE 2>&1 && cat /app/asr_billing/cfg/sorm3/data/services_$file_date.txt | wc -l >> $LOGFILE 2>&1
cp /app/asr_billing/cfg/sorm3/data/services_$file_date.txt /app/asr_billing/cfg/sorm3/done/services_$file_date.txt
curl -v -sS --user $ftplogin:$ftppass -T /app/asr_billing/cfg/sorm3/data/services_$file_date.txt ftp://$ftpip/ISP/abonents/ >> $LOGFILE 2>&1
rm -rf /app/asr_billing/cfg/sorm3/data/services_$file_date.txt
fi


chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/service_list-periodic.sql | sed '/^$/d'| sed 's/ */ /g' > /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt
if [ -f /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt ]
then
printf 'Метаданные файла\n' >> $LOGFILE 2>&1
ls -l /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt >> $LOGFILE 2>&1
printf 'Количество строк в файле: ' >> $LOGFILE 2>&1 && cat /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt | wc -l >> $LOGFILE 2>&1
cp /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt /app/asr_billing/cfg/sorm3/done/service_list_v1_$file_date.txt
curl -v -sS --user $ftplogin:$ftppass -T /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt ftp://$ftpip/ISP/abonents/ >> $LOGFILE 2>&1
rm -rf /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt
fi


chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/subscribers_v2-periodic.sql | sed '/^$/d'| sed 's/ */ /g' > /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt
if [ -f /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt ]
then
printf 'Метаданные файла\n' >> $LOGFILE 2>&1
ls -l /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt >> $LOGFILE 2>&1
printf 'Количество строк в файле: ' >> $LOGFILE 2>&1 && cat /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt | wc -l >> $LOGFILE 2>&1
cp /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt /app/asr_billing/cfg/sorm3/done/subscribers_v2_$file_date.txt
curl -v -sS --user $ftplogin:$ftppass -T /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt ftp://$ftpip/ISP/abonents/ >> $LOGFILE 2>&1
rm -rf /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt
fi
{code}
После сохранения скриптов, установите на обоих права на выполнение и перезапустите планировщик:
{code}
chmod a+x /etc/cron.hourly/vasexperts_sorm_hourly.sh
/etc/init.d/crond restart
{code}
h1. Скрипты для первоначальной выгрузки данных
Скрипты производят первичное наполнение СОРМ данными, выгружая как динамически формируемую информацию (абоненты, услуги, пополнения балансов и тд), так и статичные данные (платежные системы, план нумерации, виды документов).
Когда все статичные данные будут подготовлены и сохранены на сервере, сохраните скрипты по указанным путям. Далее, разрешите их выполнение и выполните скрипт */app/asr_billing/cfg/sorm3/upload_all.sh*
{code}
chmod a+x /app/asr_billing/cfg/sorm3/deleted_abonents.sh
chmod a+x /app/asr_billing/cfg/sorm3/fixednetid.sh
chmod a+x /app/asr_billing/cfg/sorm3/ip_numbering.sh
chmod a+x /app/asr_billing/cfg/sorm3/ip.sh
chmod a+x /app/asr_billing/cfg/sorm3/payments.sh
chmod a+x /app/asr_billing/cfg/sorm3/service_list.sh
chmod a+x /app/asr_billing/cfg/sorm3/services.sh
chmod a+x /app/asr_billing/cfg/sorm3/subscribers_v2.sh
chmod a+x /app/asr_billing/cfg/sorm3/switches.sh
chmod a+x /app/asr_billing/cfg/sorm3/upload_all.sh
bash /app/asr_billing/cfg/sorm3/upload_all.sh
{code}
*/app/asr_billing/cfg/sorm3/deleted_abonents.sh*
{code}
#!/bin/bash

source /app/asr_billing/cfg/sorm3/conf/ftp.conf

LOGFILE=/app/asr_billing/mnt/var/cfg/sorm3/Log/abonents.log
file_date=$(date +%Y%m%d%H%M)
printf '\n\n' >> $LOGFILE 2>&1
date >> $LOGFILE 2>&1

#chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/abonents.sql | sed '/^$/d'| sed 's/ */ /g' > /app/asr_billing/cfg/sorm3/data/deleted_abonents_$file_date.txt

chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/deleted_abonents.sql | sed '/^$/d'| sed 's/ */ /g' | iconv -f cp1251 -t utf8 > /app/asr_billing/cfg/sorm3/data/deleted_abonents_$file_date.txt
if [ -f /app/asr_billing/cfg/sorm3/data/deleted_abonents_$file_date.txt ]
then
# sed -i '1d' /app/asr_billing/cfg/sorm3/data/deleted_abonents_$file_date.txt
printf 'Метаданные файла\n' >> $LOGFILE 2>&1
ls -l /app/asr_billing/cfg/sorm3/data/deleted_abonents_$file_date.txt >> $LOGFILE 2>&1
printf 'Количество строк в файле: ' >> $LOGFILE 2>&1 && cat /app/asr_billing/cfg/sorm3/data/deleted_abonents_$file_date.txt | wc -l >> $LOGFILE 2>&1
cp /app/asr_billing/cfg/sorm3/data/deleted_abonents_$file_date.txt /app/asr_billing/cfg/sorm3/done/deleted_abonents_$file_date.txt
curl -v -sS --user $ftplogin:$ftppass -T /app/asr_billing/cfg/sorm3/data/deleted_abonents_$file_date.txt ftp://$ftpip/ISP/abonents/ >> $LOGFILE 2>&1
rm -rf /app/asr_billing/cfg/sorm3/data/deleted_abonents_$file_date.txt
fi
{code}
*/app/asr_billing/cfg/sorm3/fixednetid.sh*
{code}
#!/bin/bash

source /app/asr_billing/cfg/sorm3/conf/ftp.conf

LOGFILE=/app/asr_billing/mnt/var/cfg/sorm3/Log/abonents.log
file_date=$(date +%Y%m%d%H%M)
printf '\n\n' >> $LOGFILE 2>&1
date >> $LOGFILE 2>&1

#chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/abonents.sql | sed '/^$/d'| sed 's/ */ /g' > /app/asr_billing/cfg/sorm3/data/fixednetid_$file_date.txt

chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/fixednetid.sql | sed '/^$/d'| sed 's/ */ /g' | iconv -f cp1251 -t utf8 > /app/asr_billing/cfg/sorm3/data/fixednetid.txt
#chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/fixednetid.sql | sed '/^$/d'| sed 's/ */ /g' > /app/asr_billing/cfg/sorm3/data/fixednetid.txt
if [ -f /app/asr_billing/cfg/sorm3/data/fixednetid.txt ]
then
# sed -i '1d' /app/asr_billing/cfg/sorm3/data/fixednetid_$file_date.txt
printf 'Метаданные файла\n' >> $LOGFILE 2>&1
ls -l /app/asr_billing/cfg/sorm3/data/fixednetid.txt >> $LOGFILE 2>&1
printf 'Количество строк в файле: ' >> $LOGFILE 2>&1 && cat /app/asr_billing/cfg/sorm3/data/fixednetid.txt | wc -l >> $LOGFILE 2>&1
cp /app/asr_billing/cfg/sorm3/data/fixednetid.txt /app/asr_billing/cfg/sorm3/done/fixednetid_$file_date.txt
curl -v -sS --user $ftplogin:$ftppass -T /app/asr_billing/cfg/sorm3/data/fixednetid.txt ftp://$ftpip/ >> $LOGFILE 2>&1
rm -rf /app/asr_billing/cfg/sorm3/data/fixednetid.txt
fi
{code}
*/app/asr_billing/cfg/sorm3/ip_numbering.sh*
{code}
#!/bin/bash

source /app/asr_billing/cfg/sorm3/conf/ftp.conf

LOGFILE=/app/asr_billing/mnt/var/cfg/sorm3/Log/abonents.log
file_date=$(date +%Y%m%d%H%M)
printf '\n\n' >> $LOGFILE 2>&1
date >> $LOGFILE 2>&1

#chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/ip_numbering.sql | sed '/^$/d'| sed 's/ */ /g' | iconv -f cp1251 -t utf8 > /app/asr_billing/cfg/sorm3/data/service_list_$file_date.txt
chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/ip_numbering.sql | sed '/^$/d'| sed 's/ */ /g' > /app/asr_billing/cfg/sorm3/data/ip_numbering_$file_date.txt

if [ -f /app/asr_billing/cfg/sorm3/data/ip_numbering_$file_date.txt ]
then
# sed -i '1d' /app/asr_billing/cfg/sorm3/data/ip_numbering_$file_date.txt
printf 'Метаданные файла\n' >> $LOGFILE 2>&1
ls -l /app/asr_billing/cfg/sorm3/data/ip_numbering_$file_date.txt >> $LOGFILE 2>&1
printf 'Количество строк в файле: ' >> $LOGFILE 2>&1 && cat /app/asr_billing/cfg/sorm3/data/ip_numbering_$file_date.txt | wc -l >> $LOGFILE 2>&1
cp /app/asr_billing/cfg/sorm3/data/ip_numbering_$file_date.txt /app/asr_billing/cfg/sorm3/done/ip_numbering_$file_date.txt
curl -v -sS --user $ftplogin:$ftppass -T /app/asr_billing/cfg/sorm3/data/ip_numbering_$file_date.txt ftp://$ftpip/ISP/dict/ >> $LOGFILE 2>&1
rm -rf /app/asr_billing/cfg/sorm3/data/ip_numbering_$file_date.txt
fi
{code}
*/app/asr_billing/cfg/sorm3/ip.sh*
{code}
#!/bin/bash

source /app/asr_billing/cfg/sorm3/conf/ftp.conf

LOGFILE=/app/asr_billing/mnt/var/cfg/sorm3/Log/abonents.log
file_date=$(date +%Y%m%d%H%M)
printf '\n\n' >> $LOGFILE 2>&1
date >> $LOGFILE 2>&1

#chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/ip_nets_v1.sql | sed '/^$/d'| sed 's/ */ /g' | iconv -f cp1251 -t utf8 > /app/asr_billing/cfg/sorm3/data/service_list_$file_date.txt
chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/ip.sql | sed '/^$/d'| sed 's/ */ /g' > /app/asr_billing/cfg/sorm3/data/ip_nets_v1_$file_date.txt

if [ -f /app/asr_billing/cfg/sorm3/data/ip_nets_v1_$file_date.txt ]
then
# sed -i '1d' /app/asr_billing/cfg/sorm3/data/ip_nets_v1_$file_date.txt
printf 'Метаданные файла\n' >> $LOGFILE 2>&1
ls -l /app/asr_billing/cfg/sorm3/data/ip_nets_v1_$file_date.txt >> $LOGFILE 2>&1
printf 'Количество строк в файле: ' >> $LOGFILE 2>&1 && cat /app/asr_billing/cfg/sorm3/data/ip_nets_v1_$file_date.txt | wc -l >> $LOGFILE 2>&1
cp /app/asr_billing/cfg/sorm3/data/ip_nets_v1_$file_date.txt /app/asr_billing/cfg/sorm3/done/ip_nets_v1_$file_date.txt
curl -v -sS --user $ftplogin:$ftppass -T /app/asr_billing/cfg/sorm3/data/ip_nets_v1_$file_date.txt ftp://$ftpip/ISP/abonents/ >> $LOGFILE 2>&1
rm -rf /app/asr_billing/cfg/sorm3/data/ip_nets_v1_$file_date.txt
fi
{code}
*/app/asr_billing/cfg/sorm3/payments.sh*
{code}
#!/bin/bash

source /app/asr_billing/cfg/sorm3/conf/ftp.conf

LOGFILE=/app/asr_billing/mnt/var/cfg/sorm3/Log/abonents.log
file_date=$(date +%Y%m%d%H%M)
printf '\n\n' >> $LOGFILE 2>&1
date >> $LOGFILE 2>&1

#chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/abonents.sql | sed '/^$/d'| sed 's/ */ /g' > /app/asr_billing/cfg/sorm3/data/subscribers_$file_date.txt

chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/payments.sql | sed '/^$/d'| sed 's/ */ /g' | iconv -f cp1251 -t utf8 > /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt
if [ -f /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt ]
then
# sed -i '1d' /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt
printf 'Метаданные файла\n' >> $LOGFILE 2>&1
ls -l /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt >> $LOGFILE 2>&1
printf 'Количество строк в файле: ' >> $LOGFILE 2>&1 && cat /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt | wc -l >> $LOGFILE 2>&1
cp /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt /app/asr_billing/cfg/sorm3/done/payments_v1_$file_date.txt
curl -v -sS --user $ftplogin:$ftppass -T /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt ftp://$ftpip/ISP/abonents/ >> $LOGFILE 2>&1
rm -rf /app/asr_billing/cfg/sorm3/data/payments_v1_$file_date.txt
fi
{code}
*/app/asr_billing/cfg/sorm3/service_list.sh*
{code}
#!/bin/bash

source /app/asr_billing/cfg/sorm3/conf/ftp.conf

LOGFILE=/app/asr_billing/mnt/var/cfg/sorm3/Log/abonents.log
file_date=$(date +%Y%m%d%H%M)
printf '\n\n' >> $LOGFILE 2>&1
date >> $LOGFILE 2>&1

#chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/service_list.sql | sed '/^$/d'| sed 's/ */ /g' | iconv -f cp1251 -t utf8 > /app/asr_billing/cfg/sorm3/data/service_list_$file_date.txt
chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/service_list.sql | sed '/^$/d'| sed 's/ */ /g' > /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt

if [ -f /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt ]
then
# sed -i '1d' /app/asr_billing/cfg/sorm3/data/service_list_$file_date.txt
printf 'Метаданные файла\n' >> $LOGFILE 2>&1
ls -l /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt >> $LOGFILE 2>&1
printf 'Количество строк в файле: ' >> $LOGFILE 2>&1 && cat /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt | wc -l >> $LOGFILE 2>&1
cp /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt /app/asr_billing/cfg/sorm3/done/service_list_v1_$file_date.txt
curl -v -sS --user $ftplogin:$ftppass -T /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt ftp://$ftpip/ISP/abonents/ >> $LOGFILE 2>&1
rm -rf /app/asr_billing/cfg/sorm3/data/service_list_v1_$file_date.txt
fi
{code}
*/app/asr_billing/cfg/sorm3/services.sh*
{code}
#!/bin/bash

source /app/asr_billing/cfg/sorm3/conf/ftp.conf

LOGFILE=/app/asr_billing/mnt/var/cfg/sorm3/Log/abonents.log
file_date=$(date +%Y%m%d%H%M)
printf '\n\n' >> $LOGFILE 2>&1
date >> $LOGFILE 2>&1

#chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/services.sql | sed '/^$/d'| sed 's/ */ /g' | iconv -f cp1251 -t utf8 > /app/asr_billing/cfg/sorm3/data/service_list_$file_date.txt
chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/services.sql | sed '/^$/d'| sed 's/ */ /g' > /app/asr_billing/cfg/sorm3/data/services_$file_date.txt

if [ -f /app/asr_billing/cfg/sorm3/data/services_$file_date.txt ]
then
# sed -i '1d' /app/asr_billing/cfg/sorm3/data/services_$file_date.txt
printf 'Метаданные файла\n' >> $LOGFILE 2>&1
ls -l /app/asr_billing/cfg/sorm3/data/services_$file_date.txt >> $LOGFILE 2>&1
printf 'Количество строк в файле: ' >> $LOGFILE 2>&1 && cat /app/asr_billing/cfg/sorm3/data/services_$file_date.txt | wc -l >> $LOGFILE 2>&1
cp /app/asr_billing/cfg/sorm3/data/services_$file_date.txt /app/asr_billing/cfg/sorm3/done/services_$file_date.txt
curl -v -sS --user $ftplogin:$ftppass -T /app/asr_billing/cfg/sorm3/data/services_$file_date.txt ftp://$ftpip/ISP/abonents/ >> $LOGFILE 2>&1
rm -rf /app/asr_billing/cfg/sorm3/data/services_$file_date.txt
fi
{code}
*/app/asr_billing/cfg/sorm3/subscribers_v2.sh*
{code}
#!/bin/bash

source /app/asr_billing/cfg/sorm3/conf/ftp.conf

LOGFILE=/app/asr_billing/mnt/var/cfg/sorm3/Log/subscribers_v2.log
file_date=$(date +%Y%m%d%H%M)
printf '\n\n' >> $LOGFILE 2>&1
date >> $LOGFILE 2>&1

chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/subscribers_v2.sql | sed '/^$/d'| sed 's/ */ /g' > /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt

#chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/subscribers_v2.sql | sed '/^$/d'| sed 's/ */ /g' | iconv -f cp1251 -t utf8 > /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt
if [ -f /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt ]
then
# sed -i '1d' /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt
printf 'Метаданные файла\n' >> $LOGFILE 2>&1
ls -l /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt >> $LOGFILE 2>&1
printf 'Количество строк в файле: ' >> $LOGFILE 2>&1 && cat /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt | wc -l >> $LOGFILE 2>&1
cp /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt /app/asr_billing/cfg/sorm3/done/subscribers_v2_$file_date.txt
curl -v -sS --user $ftplogin:$ftppass -T /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt ftp://$ftpip/ISP/abonents/ >> $LOGFILE 2>&1
rm -rf /app/asr_billing/cfg/sorm3/data/subscribers_v2_$file_date.txt
fi
{code}
*/app/asr_billing/cfg/sorm3/switches.sh*
{code}
#!/bin/bash

source /app/asr_billing/cfg/sorm3/conf/ftp.conf

LOGFILE=/app/asr_billing/mnt/var/cfg/sorm3/Log/abonents.log
file_date=$(date +%Y%m%d%H%M)
printf '\n\n' >> $LOGFILE 2>&1
date >> $LOGFILE 2>&1

#chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/switches.sql | sed '/^$/d'| sed 's/ */ /g' | iconv -f cp1251 -t utf8 > /app/asr_billing/cfg/sorm3/data/service_list_$file_date.txt
chroot /app/asr_billing/ isql-fb 169.254.30.50:/var/db/billing.gdb -p servicem -u SYSDBA -i /cfg/sorm3/switches.sql | sed '/^$/d'| sed 's/ */ /g' > /app/asr_billing/cfg/sorm3/data/switches_$file_date.txt

if [ -f /app/asr_billing/cfg/sorm3/data/switches_$file_date.txt ]
then
#sed -i '1d' /app/asr_billing/cfg/sorm3/data/switches_$file_date.txt
printf 'Метаданные файла\n' >> $LOGFILE 2>&1
ls -l /app/asr_billing/cfg/sorm3/data/switches_$file_date.txt >> $LOGFILE 2>&1
printf 'Количество строк в файле: ' >> $LOGFILE 2>&1 && cat /app/asr_billing/cfg/sorm3/data/switches_$file_date.txt | wc -l >> $LOGFILE 2>&1
cp /app/asr_billing/cfg/sorm3/data/switches_$file_date.txt /app/asr_billing/cfg/sorm3/done/switches_$file_date.txt
curl -v -sS --user $ftplogin:$ftppass -T /app/asr_billing/cfg/sorm3/data/switches_$file_date.txt ftp://$ftpip/ISP/abonents/ >> $LOGFILE 2>&1
rm -rf /app/asr_billing/cfg/sorm3/data/switches_$file_date.txt
fi
{code}
*/app/asr_billing/cfg/sorm3/upload_all.sh*
{code}
#!/bin/bash
/app/asr_billing/cfg/sorm3/subscribers_v2.sh
/app/asr_billing/cfg/sorm3/deleted_abonents.sh
/app/asr_billing/cfg/sorm3/payments.sh
/app/asr_billing/cfg/sorm3/services.sh
/app/asr_billing/cfg/sorm3/ip.sh
/app/asr_billing/cfg/sorm3/ip_numbering.sh
/app/asr_billing/cfg/sorm3/switches.sh
/app/asr_billing/cfg/sorm3/service_list.sh
/app/asr_billing/cfg/sorm3/fixednetid.sh
{code}