-
Notifications
You must be signed in to change notification settings - Fork 41
/
restart_services.sh
executable file
·52 lines (43 loc) · 1.2 KB
/
restart_services.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
#!/bin/bash
#
# Restarts the services
#
# Not specially compatible with a wide range of server
# settings, at least it works in linux-ubuntu. Neither
# specially good if you have your database in another
# server, so I would say use it only if this is a development
# machine and you use linux.
#
# It restarts the services as listed in $servicesarray
# which are defined in webserver_config.properties.
#
##############################################
# Exit on errors.
set -e
# Dependencies.
. ./lib/lib.sh
# Load webserver-side config.
load_properties "defaults.properties"
load_properties "webserver_config.properties"
# Checks the $cmds.
check_cmds
# Only root access; prevents ugly service command error messages.
if [ "$(id -u)" != "0" ]; then
echo "Error: You can only run this script as root" >&2
exit 1
fi
# Stop all the services
for service in "${servicesarray[@]}"; do
service $service stop
done
# Start them again.
for service in "${servicesarray[@]}"; do
service $service start
done
outputinfo="
#######################################################################
Services restarted successfully.
Now you can begin running the tests with test_runner.sh.
"
echo "$outputinfo"
exit 0