-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheos_start_pre.sh
executable file
·117 lines (102 loc) · 3.8 KB
/
eos_start_pre.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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
# ----------------------------------------------------------------------
# File: eos_start_pre.sh
# Author: Ivan Arizanovic - ComTrade Solutions Engineering
# ----------------------------------------------------------------------
# ************************************************************************
# * EOS - the CERN Disk Storage System *
# * Copyright (C) 2016 CERN/Switzerland *
# * *
# * This program is free software: you can redistribute it and/or modify *
# * it under the terms of the GNU General Public License as published by *
# * the Free Software Foundation, either version 3 of the License, or *
# * (at your option) any later version. *
# * *
# * This program is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# * GNU General Public License for more details. *
# * *
# * You should have received a copy of the GNU General Public License *
# * along with this program. If not, see <http://www.gnu.org/licenses/>.*
# ************************************************************************
. /etc/sysconfig/eos_env
# Start All EOS daemons (all required daemons from config file)
if [ "$1" = "eos-all" ]; then
if [[ -z "$XRD_ROLES" ]]; then
echo "<3>Error: No XRD_ROLES variable declared in \"/etc/sysconf/eos_env\""
exit 1
fi
for i in ${XRD_ROLES}; do
systemctl start eos@${i} &
done
# Wait for all the daemons to start
FAIL=0
for job in `jobs -p`;do
echo "<5>Waiting for $job ..."
wait $job || let "FAIL+=1"
done
if [ "$FAIL" == "0" ]; then
exit 0
else
exit 1
fi
fi
# StartPre EOS daemons
if [ "$1" = "eos-start-pre" ]; then
if [[ "$XRD_ROLES" == *"$2"* ]]; then
if [ -e /etc/eos.keytab ]; then
chown daemon /etc/eos.keytab
chmod 400 /etc/eos.keytab
fi
mkdir -p /var/eos/md /var/eos/report /var/eos/auth /var/eos/stage /var/log/eos /var/spool/eos/core/${2} /var/spool/eos/admin
chmod 755 /var/eos /var/eos/report
chmod -R 775 /var/spool/eos
# chown -R daemon /var/spool/eos
# find /var/log/eos -maxdepth 1 -type d -exec chown daemon {} \;
# find /var/eos/ -maxdepth 1 -mindepth 1 -not -path "/var/eos/fs" -not -path "/var/eos/fusex" -type d -exec chown -R daemon {} \;
# chown daemon /var/eos/auth /var/eos/stage
setfacl -m default:u:daemon:r /var/eos/auth/
# Require cmsd for fed daemon
if [ "$2" = "fed" ]; then
systemctl start cmsd@clustered
fi
else
echo "<3>Error: Service $2 not in the XRD_ROLES in \"/etc/sysconf/eos_env\""
exit 1
fi
fi
# Stop EOS daemons
if [ "$1" = "eos-stop" ]; then
if [ "$2" = "fed" ]; then
systemctl stop cmsd@clustered
fi
fi
# Start EOS Master
if [ "$1" = "eos-master" ]; then
if [[ "$XRD_ROLES" == *"mq"* ]]; then
touch /var/eos/eos.mq.master
fi
if [[ "$XRD_ROLES" == *"mgm"* ]]; then
touch /var/eos/eos.mgm.rw
fi
fi
# Start EOS Slave
if [ "$1" = "eos-slave" ]; then
if [[ "$XRD_ROLES" == *"mq"* ]]; then
unlink /var/eos/eos.mq.master
fi
if [[ "$XRD_ROLES" == *"mgm"* ]]; then
unlink /var/eos/eos.mgm.rw
fi
fi
# Start EOS fuse daemons
if [ "$1" = "eosd-start" ]; then
mkdir -p /var/run/eosd/ /var/run/eosd/credentials/store ${EOS_FUSE_MOUNTDIR}
chmod 1777 /var/run/eosd/credentials /var/run/eosd/credentials/store
chmod 755 ${EOS_FUSE_MOUNTDIR}
fi
# Stop EOS fuse daemons
if [ "$1" = "eosd-stop" ]; then
umount -f ${EOS_FUSE_MOUNTDIR}
fi