Ok. This json generates a file without the last two characters. This
problem happens only using the web interface not the netjsonconfig command
line.
{
"files": [
{
"contents":
"#!/bin/sh\n\npostar_arquivo_no_servidor(){\n\tTIPO=$1\n\tARQUIVO=$2\n\tlogger
\"Script Monitoramento: enviando $ARQUIVO ao servidor.\"\n\tcurl -u
fdsfdsfdsf -T $ARQUIVO $URL_NETAG\n\trm -f
$ARQUIVO\n}\n\nenvia_dhcp_leases(){\n logger \"Script Monitoramento:
gerando o arquivo dhcp.leases\"\n\tARQ_DHCP=/tmp/[email protected]\n\techo
$NOME > $ARQ_DHCP\n\tcat /tmp/dhcp.leases >>
$ARQ_DHCP\n\tpostar_arquivo_no_servidor \"dhcp\"
$ARQ_DHCP\n}\n\nenvia_macs_identificados_na_lan(){\n logger \"Script
Monitoramento: gerando o arquivo de entradas
ARP\"\n\tARQ_ARP=/tmp/[email protected]\n\techo $NOME > $ARQ_ARP\n\tcat
/proc/net/arp | grep -v 00:00:00:00:00:00 >>
$ARQ_ARP\n\tpostar_arquivo_no_servidor \"arp\"
$ARQ_ARP\n}\n\nenvia_saida_traceroute(){\n logger \"Script
Monitoramento: gerando arquivo
traceroute\"\n\tARQ_TRACERT=/tmp/[email protected]\n\ttraceroute -m 4
8.8.8.8 >> $ARQ_TRACERT\n\tpostar_arquivo_no_servidor \"tracert\"
$ARQ_TRACERT\n}\n\nenvia_saida_iw_scan(){\n logger \"Script
Monitoramento: gerando arquivo
iwscan\"\n\tARQ_IWSCAN=/tmp/[email protected]\n\tpostar_arquivo_no_servidor
\"iwscan\" $ARQ_IWSCAN\n}\n\nenvia_saida_bandwidthd(){\n\tif [ -f
/usr/sbin/bandwidthd ]; then\n logger \"Script
Monitoramento: gerando arquivo de monitoramento de
banda\"\n\t\tARQ_BANDWIDTHD=/tmp/[email protected]\n\t\twget
http://localhost/bandwidthd/index.html -O
$ARQ_BANDWIDTHD\n\t\tpostar_arquivo_no_servidor \"bandwidthd\"
$ARQ_BANDWIDTHD\n\telse\n\t\tlogger \"Script Monitoramento: pacote
bandwidthd não localizado. Baixando e habilitando\"\n\t\topkg
update\n\t\topkg install bandwidthd\n\t\tsed -i 's/option
graph\\t\\ttrue/option graph\\t\\tfalse/g' /etc/config/bandwidthd\n\t\tsed
-i -r 's/192.168.1.0([^0-9]+|$)/192.168.123.0\\1/g'
/etc/config/bandwidthd\n\t\t/etc/init.d/bandwidthd
enable\n\t\t/etc/init.d/bandwidthd
start\n\tfi\n}\n\nverifica_certificado_(){\n\tlogger \"Sript Monitoramento:
Verificando certificado.\"\n\tif [ ! -f /etc/ssl/certs/CA.cer ];
then\n\t\tlogger \"Script Monitoramento: certificado não localizado.
Baixando...\"\n\t\twget http://wwww.domain.com/CA.cer -P
/etc/ssl/certs/\n\telse\n\t\tlogger \"Script Monitoramento: certificado
localizado.\"\n\tfi\n}\n\nsleep_a_while(){\n\tTEMPO=$(awk
'BEGIN{srand();print int(rand()*300)}')\n\tlogger \"Script Monitoramento:
esperando $TEMPO segundos antes da coleta.\"\n\tsleep
$TEMPO\n}\nNOME=$(uname -n)\nMAC=$(cat
/sys/devices/platform/ag71xx.1/net/eth1/address | tr \":\"
\"-\")\nPREFIXO_ARQ=${NOME}@`date
+%Y-%m-%d_%H-%M`@${MAC}\nsleep_a_while\nverifica_certificado\nenvia_dhcp_leases
$PREFIXO_ARQ\nenvia_saida_traceroute $PREFIXO_ARQ\nenvia_saida_iw_scan
$PREFIXO_ARQ\nenvia_macs_identificados_na_lan
$PREFIXO_ARQ\nenvia_saida_bandwidthd $PREFIXO_ARQ",
"path": "/bin/script.sh",
"mode": "0777"
}
]
}
--
You received this message because you are subscribed to the Google Groups
"OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.