Взять IP из файла .txt и вставить каждый в свою переменную
Добавлено: 04 окт 2022, 23:41
Здраствуйте! Есть файл null_ip.txt в котором прописан 123.123.123.123:9999. Файл раз в сутки качается с FTP. Есть скрипт и он работает.
/interface sstp-client remove [find]
:set $ip [/file get "null_ip.txt" contents];
:global IP $ip
:log info $ip;
:log info "1";
:local user "user1";
/interface sstp-client
add authentication=mschap1,mschap2 connect-to=$ip disabled=no \
name=sstp-out1 password=qwerty123 profile=default-encryption user=\
$user
:log info "2";
Задача что бы скрип делал sstp-client на четыре IP. Т.е. в файле null_ip прописано вертикально 123.123.123.123:9999 222.222.222.222:9999 172.172.172.172.:9999 10.10.10.10:9999 и скрипт выше не работает конечно. Не хочется делать четыре файла txt. Не могу понять как изменить начало, я так полагаю надо наверное парсить лог.
/interface sstp-client remove [find]
:set $ip [/file get "null_ip.txt" contents];
:global IP $ip1
:global IP $ip2
:global IP $ip3
:global IP $ip4
:log info $ip;
:log info "1";
:local user "user1";
/interface sstp-client
add authentication=mschap1,mschap2 connect-to=$ip1 disabled=no \
name=sstp-out1 password=qwerty123 profile=default-encryption user=\
$user
/interface sstp-client
add authentication=mschap1,mschap2 connect-to=$ip2 disabled=no \
name=sstp-out2 password=qwerty123 profile=default-encryption user=\
$user
/interface sstp-client
add authentication=mschap1,mschap2 connect-to=$ip3 disabled=no \
name=sstp-out3 password=qwerty123 profile=default-encryption user=\
$user
/interface sstp-client
add authentication=mschap1,mschap2 connect-to=$ip4 disabled=no \
name=sstp-out4 password=qwerty123 profile=default-encryption user=\
$user
:log info "2";
/interface sstp-client remove [find]
:set $ip [/file get "null_ip.txt" contents];
:global IP $ip
:log info $ip;
:log info "1";
:local user "user1";
/interface sstp-client
add authentication=mschap1,mschap2 connect-to=$ip disabled=no \
name=sstp-out1 password=qwerty123 profile=default-encryption user=\
$user
:log info "2";
Задача что бы скрип делал sstp-client на четыре IP. Т.е. в файле null_ip прописано вертикально 123.123.123.123:9999 222.222.222.222:9999 172.172.172.172.:9999 10.10.10.10:9999 и скрипт выше не работает конечно. Не хочется делать четыре файла txt. Не могу понять как изменить начало, я так полагаю надо наверное парсить лог.
/interface sstp-client remove [find]
:set $ip [/file get "null_ip.txt" contents];
:global IP $ip1
:global IP $ip2
:global IP $ip3
:global IP $ip4
:log info $ip;
:log info "1";
:local user "user1";
/interface sstp-client
add authentication=mschap1,mschap2 connect-to=$ip1 disabled=no \
name=sstp-out1 password=qwerty123 profile=default-encryption user=\
$user
/interface sstp-client
add authentication=mschap1,mschap2 connect-to=$ip2 disabled=no \
name=sstp-out2 password=qwerty123 profile=default-encryption user=\
$user
/interface sstp-client
add authentication=mschap1,mschap2 connect-to=$ip3 disabled=no \
name=sstp-out3 password=qwerty123 profile=default-encryption user=\
$user
/interface sstp-client
add authentication=mschap1,mschap2 connect-to=$ip4 disabled=no \
name=sstp-out4 password=qwerty123 profile=default-encryption user=\
$user
:log info "2";