-
Notifications
You must be signed in to change notification settings - Fork 23
/
restore.sh
executable file
·66 lines (45 loc) · 1.56 KB
/
restore.sh
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
#!/bin/bash
./install.sh
source /usr/local/lib/yourchili/yourchili.sh
HOSTNAME="mysite.com"
DB_PASSWORD="password"
NGINX_USER="www-data"
NGINX_GROUP="www-data"
USER="librarian"
USER_PW="ookook"
USER_FIRST_NAME="The"
USER_LAST_NAME="Librarian"
USER_EMAIL="librarian@uu.edu.am"
BACKUP_DIR="/backups" #directory where we store backups
#updates packages to latest versions
upgrade_system
#sets detailed (2-line) bash prompt that includes date/time
#otherwise we just use short 1-line bash prompt (but still colored)
better_bash_prompt 1
#set hostname and allowed ports
#port 22=ssh; 80,443=http,https; 25,110,587=email; 9418=git
set_hostname "$HOSTNAME"
set_open_ports 22 80 443 25 110 587 9418
# Add an admin user
# Last arg indicates that this is an admin
add_user "$USER" "$USER_PW" "1"
#install mysql, let it use up to 30% of memory
mysql_install "$DB_PASSWORD"
mysql_tune
#install nginx, along with both passenger(ruby) and php
nginx_install "$NGINX_USER" "$NGINX_GROUP" "1" "1"
nginx_delete_site default
#restore -- note, always restore in this order: mysql, projects, sites
restore_mysql root "$DB_PASSWORD" "$BACKUP_DIR"
restore_projects "$BACKUP_DIR"
restore_sites "$BACKUP_DIR"
restore_hostname "$BACKUP_DIR"
restore_mail_config "$BACKUP_DIR"
#configure backups --note that this may nearly double your disk usage
#since everything gets tarred and saved to a different directory once a day
#
# setup_backup_cronjob takes 2 parameters:
# 1) The root database password
# 2) the directory to save backups to
#
setup_backup_cronjob "$DB_PASSWORD" "$BACKUP_DIR"