diff --git a/modules/rhizomatica_base_system/files/bin/check_amp_status.sh b/modules/rhizomatica_base_system/files/bin/check_amp_status.sh index efed5e4..b963eba 100755 --- a/modules/rhizomatica_base_system/files/bin/check_amp_status.sh +++ b/modules/rhizomatica_base_system/files/bin/check_amp_status.sh @@ -1,4 +1,7 @@ #!/bin/sh +# Check for AMP status on each BTS, from BTS1 up to BTS10 . ./vars.sh -echo "BTS1: " -ssh root@$BTS1 sbts2050-util sbts2050-pwr-status | grep Amp +for bts in $BTS1 $BTS2 $BTS3 $BTS4 $BTS5 $BTS6 $BTS7 $BTS7 $BTS8 $BTS9 $BTS10; do + echo "BTS $bts:"; + ssh root@$bts sbts2050-util sbts2050-pwr-status | grep Amp; +done diff --git a/modules/rhizomatica_base_system/files/bin/turn_on_amplifier.sh b/modules/rhizomatica_base_system/files/bin/turn_on_amplifier.sh index 81e9dd4..b05560a 100755 --- a/modules/rhizomatica_base_system/files/bin/turn_on_amplifier.sh +++ b/modules/rhizomatica_base_system/files/bin/turn_on_amplifier.sh @@ -1,34 +1,9 @@ #!/bin/bash +# Turn on AMP on all BTS, from BTS1 to BTS 10 . ./vars.sh +LOGFILE="/var/log/rhizomatica/monitor_amp.log" -echo "Beginning amplifier procedure... brace yourself!" - -echo "turning off osmo-nitb and kannel" -sv stop osmo-nitb -/etc/init.d/kannel stop - -echo "Rebooting first BTS" -ssh root@$BTS1 "/sbin/reboot" - -echo "sleeping 30 seconds..." -sleep 30 - -echo "turning off the second BTS" -ssh root@$BTS1 "/usr/bin/sbts2050-util sbts2050-pwr-enable 1 0 0" - -echo "sleeping 10 seconds..." -sleep 10 - -echo "turning on the amplifier" -ssh root@$BTS1 "/usr/bin/sbts2050-util sbts2050-pwr-enable 1 0 1" - -echo "sleeping 10 seconds..." -sleep 10 - -echo "turning back on the second BTS" -ssh root@$BTS1 "/usr/bin/sbts2050-util sbts2050-pwr-enable 1 1 1" - -echo "turning on osmo-nitb and kannel" -sv start osmo-nitb -sleep 10 -/etc/init.d/kannel start +for bts in $BTS1 $BTS2 $BTS3 $BTS4 $BTS5 $BTS6 $BTS7 $BTS7 $BTS8 $BTS9 $BTS10; do + logc "Turning on AMP on BTS $bts:" + ssh root@$bts "sbts2050-util sbts2050-pwr-enable 1 1 1"; +done diff --git a/modules/rhizomatica_base_system/files/etc/cron.d/rhizomatica b/modules/rhizomatica_base_system/files/etc/cron.d/rhizomatica index 7249b08..31b1528 100644 --- a/modules/rhizomatica_base_system/files/etc/cron.d/rhizomatica +++ b/modules/rhizomatica_base_system/files/etc/cron.d/rhizomatica @@ -1,16 +1,34 @@ #Rhizomatica cron jobs PYTHONPATH=$PYTHONPATH:/var/rhizomatica/rccn -# m h dom mon dow user command - 0 8 1 * * root /usr/bin/python /var/rhizomatica/rccn/rsc.py notice - 0 8 3 * * root /usr/bin/python /var/rhizomatica/rccn/rsc.py reminder - 0 21 7 * * root /usr/bin/python /var/rhizomatica/rccn/rsc.py deactivate - 0 */5 * * * root /var/rhizomatica/bin/check_account_balance.sh - 0 3 * * * root /var/rhizomatica/bin/sms_cleanup.sh -*/5 * * * * root /var/rhizomatica/bin/platform_update_rrd.sh -*/5 * * * * root /var/rhizomatica/bin/network_update_rrd.sh -# */10 * * * * root /home/rhizomatica/bin/bind_check.sh -*/10 * * * * root /usr/bin/python /var/rhizomatica/rccn/rrc.py && /usr/bin/python /var/rhizomatica/rccn/rhs.py +# m h dom mon dow user command + +#SMS reminders for users + 0 8 1 * * root /usr/bin/python /var/rhizomatica/rccn/rsc.py notice + 0 8 3 * * root /usr/bin/python /var/rhizomatica/rccn/rsc.py reminder + 0 21 7 * * root /usr/bin/python /var/rhizomatica/rccn/rsc.py deactivate + +#SMS reminder for admin + 0 */5 * * * root /var/rhizomatica/bin/check_account_balance.sh + +#SMS cleanup + 0 3 * * * root /var/rhizomatica/bin/sms_cleanup.sh + +#RRDtools graphs +*/5 * * * * root /var/rhizomatica/bin/platform_update_rrd.sh +*/5 * * * * root /var/rhizomatica/bin/network_update_rrd.sh + +#Bind check between OpenBSC and Kannel (disabled) +# */10 * * * * root /home/rhizomatica/bin/bind_check.sh + +#Roaming jobs +*/10 * * * * root /usr/bin/python /var/rhizomatica/rccn/rrc.py && /usr/bin/python /var/rhizomatica/rccn/rhs.py > /dev/null 2>&1 + +#Cleanup inactive users + 0 5 * * * root /usr/bin/python /var/rhizomatica/rccn/rip.py > /dev/null 2>&1 + # amplifier monitoring -*/10 * * * * root /home/rhizomatica/bin/monitor_amp.sh -*/10 * * * * root /var/rhizomatica/bin/monitor_rapi.sh > /dev/null +*/10 * * * * root /home/rhizomatica/bin/monitor_amp.sh > /dev/null 2>&1 + +# RAPI monitoring +*/10 * * * * root /var/rhizomatica/bin/monitor_rapi.sh > /dev/null 2>&1 diff --git a/modules/rhizomatica_base_system/templates/vars.sh.erb b/modules/rhizomatica_base_system/templates/vars.sh.erb index 19d801c..b1d6dec 100644 --- a/modules/rhizomatica_base_system/templates/vars.sh.erb +++ b/modules/rhizomatica_base_system/templates/vars.sh.erb @@ -1,3 +1,51 @@ #!/bin/sh +RHIZO_SCRIPT="/home/rhizomatica/bin" + +function logc() { + txt=$1 + echo "[`date '+%d-%m-%Y %H:%M:%S'`] $txt" >> $LOGFILE +} + +#BTSs IP addresses + +<% if @bts1_ip_address %> BTS1=<%= @bts1_ip_address %> +<% end %> + +<% if @bts2_ip_address %> +BTS2=<%= @bts2_ip_address %> +<% end %> + +<% if @bts3_ip_address %> +BTS3=<%= @bts3_ip_address %> +<% end %> + +<% if @bts4_ip_address %> +BTS4=<%= @bts4_ip_address %> +<% end %> + +<% if @bts5_ip_address %> +BTS5=<%= @bts5_ip_address %> +<% end %> + +<% if @bts6_ip_address %> +BTS6=<%= @bts6_ip_address %> +<% end %> + +<% if @bts7_ip_address %> +BTS7=<%= @bts7_ip_address %> +<% end %> + +<% if @bts8_ip_address %> +BTS8=<%= @bts8_ip_address %> +<% end %> + +<% if @bts9_ip_address %> +BTS9=<%= @bts9_ip_address %> +<% end %> + +<% if @bts10_ip_address %> +BTS10=<%= @bts10_ip_address %> +<% end %> + RECIPIENTS=<%= @mail_admins %>