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?
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?