-
Notifications
You must be signed in to change notification settings - Fork 7
/
install.sh
71 lines (57 loc) · 1.32 KB
/
install.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
67
68
69
70
71
#!/bin/bash
rootDir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
scriptsDir="${rootDir}/scripts"
# Show log function
show_log () {
# -F = --follow=name --retry
tail -F /home/sfserver/log/console/sfserver-console.log
}
test_alert () {
if [ "${TEST_ALERT,,}" == 'yes' ]; then
source $scriptsDir/server_alerts.sh
fi
}
# Check requeriments
# Check if server have been installed
if [ ! -f serverfiles/DONT_REMOVE.txt ]; then
source $scriptsDir/first_install.sh
fi
echo "# Crontab file" > crontab.txt
if [ "${BACKUP,,}" == 'yes' ]; then
source $scriptsDir/crontab/backup.sh
fi
if [ "${MONITOR,,}" == 'yes' ]; then
source $scriptsDir/crontab/monitor.sh
fi
echo "# Don't remove the empty line at the end of this file. It is required to run the cron job" >> crontab.txt
crontab crontab.txt
rm crontab.txt
# Use of case to avoid errors if used wrong START_MODE
case $START_MODE in
0)
exit
;;
1)
source $scriptsDir/server_start.sh
test_alert
show_log
;;
2)
source $scriptsDir/server_update.sh
exit
;;
3)
source $scriptsDir/server_update.sh
source $scriptsDir/server_start.sh
test_alert
show_log
;;
4)
source $scriptsDir/server_backup.sh
exit
;;
*)
source $scriptsDir/check_startMode.sh
exit
;;
esac