-
Notifications
You must be signed in to change notification settings - Fork 0
/
recording4.sh
103 lines (93 loc) · 2.82 KB
/
recording4.sh
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
# This code is the property of VitalPBX LLC Company
# License: Proprietary
# Date: 20-May-2023
# VitalPBX Recording Replica with Lsync
#
set -e
function jumpto
{
label=$start
cmd=$(sed -n "/$label:/{:a;n;p;ba};" $0 | grep -v ':$')
eval "$cmd"
exit
}
echo -e "\n"
echo -e "************************************************************"
echo -e "* Welcome to the VitalPBX Recording Replica installation *"
echo -e "* All options are mandatory *"
echo -e "************************************************************"
filename="config.txt"
if [ -f $filename ]; then
echo -e "config file"
n=1
while read line; do
case $n in
1)
ip_master=$line
;;
esac
n=$((n+1))
done < $filename
echo -e "IP New Server............ > $ip_master"
fi
while [[ $ip_master == '' ]]
do
read -p "IP New Server............. > " ip_master
done
echo -e "************************************************************"
echo -e "* Check Information *"
echo -e "* Make sure both servers see each other *"
echo -e "************************************************************"
while [[ $veryfy_info != yes && $veryfy_info != no ]]
do
read -p "Are you sure to continue with this settings? (yes,no) > " veryfy_info
done
if [ "$veryfy_info" = yes ] ;then
echo -e "************************************************************"
echo -e "* Starting to run the scripts *"
echo -e "************************************************************"
else
exit;
fi
cat > config.txt << EOF
$ip_master
EOF
echo -e "************************************************************"
echo -e "* Configure Sync in Old Server *"
echo -e "************************************************************"
cat > /etc/lsyncd/lsyncd.conf.lua << EOF
----
-- User configuration file for lsyncd.
--
-- Simple example for default rsync.
--
settings {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd.status",
statusInterval = 20,
nodaemon = false,
insist = true,
}
sync {
default.rsyncssh,
source = "/var/spool/asterisk/monitor",
host = "$ip_master",
targetdir = "/var/spool/asterisk/monitor",
rsync = {
owner = true,
group = true
}
ssh = {
port = 22
}
}
EOF
systemctl enable lsyncd.service
systemctl restart lsyncd.service
echo -e "************************************************************"
echo -e "* Record Replication has started, this process can take a *"
echo -e "* long time depending on the number of recordings, you can *"
echo -e "* monitor the process by running the following command: *"
echo -e "* cat /var/log/lsyncd/lsyncd.status *"
echo -e "************************************************************"