forked from justalinko/dbackres
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
97 lines (89 loc) · 4.28 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
title="Backup - Restore Program - linuXcode.org"
bactit="Backup - Restore Database Made by <3 + Alinko BLC Telkom Klaten"
a_load(){
{
for (( i = $2 ; i <= $3 ; i++ )); do
sleep 0.1
echo "$i"
done
} | whiptail --title "linuXcode.org" --backtitle "$bactit" --gauge "$1" 10 69 0
}
install_dbackres(){
whiptail --title "$title" --backtitle "$bactit" --scrolltext --textbox Welcome.md 30 100
whiptail --title "$title" --backtitle "$bactit" --scrolltext --textbox LICENSE 30 100
a_load "Creating Directory /var/db_backres/backup ..." 0 25
mkdir -p /var/db_backres > /dev/null 2>&1
mkdir -p /var/db_backres/backup > /dev/null 2>&1
chmod 755 -R /var/db_backres/backup > /dev/null 2>&1
a_load "Creating File Log /var/log/db_backup.log ..." 25 30
touch /var/log/db_backup.log > /dev/null 2>&1
echo "#JeparaCodeRulez alinko kun shutdown57" >> /var/log/db_backup.log
a_load "Creating File Configuration /etc/db_backres/db_alinko.conf ..." 30 40
mkdir -p /etc/db_backres
touch /etc/db_backres/db_alinko.conf > /dev/null 2>&1
a_load "Configure /etc/db_backres/db_alinko.conf ..." 40 50
cat Welcome.md >> /etc/db_backres/db_alinko.conf
echo "#FORMAT TANGGAL " >> /etc/db_backres/db_alinko.conf
echo formatgl=\`date +%T_%F\` >> /etc/db_backres/db_alinko.conf
echo "#NAMA BACKUP DATABASE " >> /etc/db_backres/db_alinko.conf
echo name_db=\"db-backup-alinko-\"\$formatgl\".sql\" >> /etc/db_backres/db_alinko.conf
echo "#DIRECTORY BACKUP " >> /etc/db_backres/db_alinko.con
echo path_backup=\"/var/db_backres/backup\" >> /etc/db_backres/db_alinko.conf
echo "#GABUNGAN DARI NAMA BACKUP DAN DIRECTORY BACKUP" >> /etc/db_backres/db_alinko.conf
a_load "Configure Dulu hehehe tunggu eaa..." 50 57
echo backupdb=\$path_backup/\$name_db >> /etc/db_backres/db_alinko.conf
echo "#NAMA BACKUP STATIC " >> /etc/db_backres/db_alinko.conf
echo backupdbs=\$path_backup/\"new-db-backup.sql\" >> /etc/db_backres/db_alinko.conf
whiptail --title "$title" --backtitle "$bactit" --msgbox "Anda akan mengkonfigurasi Koneksi Ke Database :) \n
Mohon konfigurasi dengan benar \n
Jika ada kesalahan konfigurasi manual di /etc/db_backres/db_alinko.conf " 10 80
hostname_a=$(whiptail --title "$title" --backtitle "$bactit" --inputbox "Masukan Hostname :" 10 80 3>&1 1>&2 2>&3 3>&1)
username_a=$(whiptail --title "$title" --backtitle "$bactit" --inputbox "Masukan Username :" 10 80 3>&1 1>&2 2>&3 3>&1)
password_a=$(whiptail --title "$title" --backtitle "$bactit" --inputbox "Masukan Password :" 10 80 3>&1 1>&2 2>&3 3>&1)
database_a=$(whiptail --title "$title" --backtitle "$bactit" --inputbox "Masukan Database :" 10 80 3>&1 1>&2 2>&3 3>&1)
a_load "Configure Hostname ..." 57 60
echo "#HOSTNAME DATABASE" >> /etc/db_backres/db_alinko.conf
echo "hostname_a=\""$hostname_a"\"" >> /etc/db_backres/db_alinko.conf
a_load "Configure Username ..." 60 70
echo "#USERNAME DATABASE" >> /etc/db_backres/db_alinko.conf
echo "username_a=\""$username_a"\"" >> /etc/db_backres/db_alinko.conf
a_load "Configure Password ..." 70 76
echo "#PASSWORD DATABASE " >> /etc/db_backres/db_alinko.conf
echo "password_a=\""$password_a"\"" >> /etc/db_backres/db_alinko.conf
a_load "Configure Database ..." 76 85
echo "#DATABASE NAME" >> /etc/db_backres/db_alinko.conf
echo "db_name=\""$database_a"\"" >> /etc/db_backres/db_alinko.conf
a_load "Creating Directory /opt/db_backres/ , Copying files ..." 85 90
mkdir -p /opt/db_backres/
cp -r * /opt/db_backres/
cp dbackres.tools /usr/bin/dbackres
chmod 755 /usr/bin/dbackres
chmod 755 -R /opt/db_backres
a_load "Finishing ..." 90 95
sleep 3
whiptail --msgbox "Installasi Telah Selesai. \n Silakan Atur cronjob dengan perintah \n
[ RESTORE ] * * * * * /usr/bin/dbackres restore \n
[ BACKUP ] * * * * * /usr/bin/dbackres backup \n
[ COMPRESS ] * * * * * /usr/bin/dbackres compress \n
[ ALL FUNC ] * * * * * /usr/bin/dbackres --all-functions \n
------------------------------------------------------- \n
| Untuk Panduan Manual Nya, dengan perintah : dbackres --help \n
------------------------------------------------------- \n
" 15 70
a_load "Running Crontab Command ..." 95 100
sleep 2
clear
crontab -e
sleep 1
clear
echo "Thanks For Install :* - JeparaCodeRulez."
}
if [[ `whoami` == "root" ]]; then
install_dbackres
else
echo "[+] Welcome to dbackres v0.3.0 :*"
sleep 1
echo "[-] You Need Be Root To Run This Script :*"
echo "regards : shutdown57 a.k.a alinko"
fi