Ad Widget

Collapse

zabbix-server-pgsql4.0-lts, please evaluate my backup script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Infra_HDC
    Junior Member
    • May 2019
    • 5

    #1

    zabbix-server-pgsql4.0-lts, please evaluate my backup script

    Hello everybody!
    I wrote a small backup script and want to receive feedbak about it.

    user@host:~/my-scripts$ cat zabbix-bak.sh
    #!/bin/bash
    if [[ `id -u` != 0 ]]
    then
    echo Run it from root
    exit 1
    fi
    ZB_ID=$(date +%Y%m%d-%H%M%S)
    ZB_DIR=var/${ZB_ID}
    mkdir -p ${ZB_DIR} ; pushd ${ZB_DIR}
    sudo -u postgres pg_dump zabbix | gzip > ./zabbix.pg.sql.gz
    tar czvf ./etc-zabbix.tar.gz /etc/zabbix
    popd
    7za a -p $(hostname)-${ZB_ID}-001.7z ${ZB_DIR} *.sh

    Is my algorythm fully correct or not?
Working...