-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmtkvariables
64 lines (59 loc) · 1.73 KB
/
mtkvariables
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
# Made by Sinfallas <sinfallas@yahoo.com>
# Licence: GPL-2
LC_ALL=C
LOCKFD="150"
qre="qrencode -c -m 1 -s 10 -l H -d 100"
cssh="ssh -4 -C -q -o StrictHostKeyChecking=no -o ConnectTimeout=3"
cscp="scp -4 -C -o ConnectTimeout=3"
ctar="tar -czf"
back="system backup save dont-encrypt=yes"
terse="export terse compact show-sensitive"
nocaps="7130"
donde="/app"
cmdcorreo="swaks -4 --to ${cdestinos} --from ${cfrom} --server ${cserver}:${cport} -tls --auth LOGIN --auth-user ${cuser} --auth-password ${cpass} --timeout 60s"
fecha=$(date +%d-%m-%Y)
function lock () {
echo {LOCKFD}>$LOCKFILE
flock -n $LOCKFD
}
function exit_error () {
echo "ERROR: Ya hay una instancia en ejecución. Saliendo"
exit 1
}
function ayuda () {
echo "ERROR: faltan variables de entorno."
exit 1
}
function queversion () {
if [[ "$sshport" == "22" ]]; then
wver=$(sshpass -p ${sshpass} ${cssh} ${suser}@${i} "system resource print" | grep version: | awk '{print $2}')
xver=$(echo "${wver//.}")
else
wver=$(sshpass -p ${sshpass} ${cssh} -p ${sshport} ${suser}@${i} "system resource print" | grep version: | awk '{print $2}')
xver=$(echo "${wver//.}")
fi
if (( $xver < $nocaps )); then
wcmd="caps"
else
wcmd="wifi"
fi
echo "version: $xver"
echo "comando: $wcmd"
}
function queversion2 () {
if [[ "$sshport" == "22" ]]; then
wver=$(sshpass -p ${sshpass} ${cssh} ${suser}@${ips} "system resource print" | grep version: | awk '{print $2}')
xver=$(echo "${wver//.}")
else
wver=$(sshpass -p ${sshpass} ${cssh} -p ${sshport} ${suser}@${ips} "system resource print" | grep version: | awk '{print $2}')
xver=$(echo "${wver//.}")
fi
if (( $xver < $nocaps )); then
wcmd="caps"
else
wcmd="wifi"
fi
echo "version: $xver"
echo "comando: $wcmd"
}