#!/bin/bash
SCRIPT_PATH=$(cd $(dirname $0);pwd)
SELF_FILE=$(basename $0)

echo "[$(date +%Y)-$(/bin/date +%m)-$(/bin/date +%d) $(date +%H):$(date +%M):$(date +%S)] start to deal dbm bug shell" >> /tmp/deal_dbm_pro.log
export file=`echo /opt/oss/manager/apps/NodeAgent/etc/sysconf/NodeAgent-*.json` &&export p=`su ossadm -c ". /opt/oss/manager/bin/engr_profile.sh;python -c \"from util import ossext;from uniep.utils.json import easyjson; print(ossext.Cipher().decrypt0(easyjson.load_json_file('${file}').get('redis', {}).get('configdb', {})[0].get('passwd', '')))\";"`&& /opt/redis/bin/redis-cli -cipherdir `cat /opt/redis/data/configdb*/redis.conf | grep cipher-dir | awk  '{print $2}'` -a configdb@ossdbuser@${p} -p `grep port /opt/redis/data/configdb-*/redis.conf|awk '{print $2}'` -h `grep bind /opt/redis/data/configdb-*/redis.conf|awk '{print $2}'` del subject/db-agent.dbcdc >> /tmp/deal_dbm_pro.log
echo "[$(date +%Y)-$(/bin/date +%m)-$(/bin/date +%d) $(date +%H):$(date +%M):$(date +%S)] end to deal dbm bug shell" >> /tmp/deal_dbm_pro.log