#!/bin/bash

# возвращает сколько дней осталось до истечения срока действия сертификата

#CERT=/etc/nginx/cert/201516.cert
#CERT=$(cat /etc/nginx/include.d/ssl.conf | grep "ssl_certificate " | awk {' print "/etc/nginx/" $2 '} | tr -d ";")
CERT=${1}

CUR_DATE_SEC=$(date +%s)

EXP_DATE=$(/usr/bin/openssl x509 -in ${CERT} -noout -enddate | cut -f2 -d'=')
EXP_DATE_SEC=$(date --date="${EXP_DATE}" +%s)

SEC_IN_DAY=86400

RESULT=$(( (${EXP_DATE_SEC} - ${CUR_DATE_SEC}) / ${SEC_IN_DAY} ))

#echo "${CERT}"
#echo "${CUR_DATE_SEC}"
#echo "${EXP_DATE}"
#echo "${EXP_DATE_SEC}"
echo "${RESULT}"

#exit ${RESULT}

sudo -i -u postgres pg_dump zabbix > /tmp/zabbix_db.sql
yum install http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
yum clean all
systemctl stop zabbix-server.service
systemctl stop zabbix-agent.service
systemctl stop postgresql-9.6.service
yum update

# Create new branch and switch to it
function svn_bswitch()
{
branch=$1; shift
msg="$1"; shift

URL=$(svn info . | sed -ne 's@URL: \(.*\)@\1@p')
REPO=$(svn info . | sed -ne 's@Repository Root: \(.*\)@\1@p')
BRANCH_URL=$REPO/branch/$branch

svn copy $URL $BRANCH_URL -m "$msg"
}


# Switch to a branch or tag
function svn_switch()
{
d=$1; shift
REPO=$(svn info . | sed -ne 's@Repository Root: \(.*\)@\1@p')
URL=$REPO/$d
svn switch $URL
}



ebtables -t nat -A PREROUTING -p arp --arp-opcode request --arp-ip-dst 192.168.11.11 -j arpreply --arpreply-mac 00:11:22:33:44:55 

Difference here is that this rule operates on the NAT table and not on the FILTER table. All incoming packages on the ethernet bridge are going to pass this prerouting chain. If this special arp packages passes by, the router will answer it and delivers the correct arp address to the sender. So this is working like a very simple ARP Proxy...