Skip to content

Commit 783f371

Browse files
Merge pull request #20 from matyasselmeci/pr/cconfig.SOFTWARE-4933
Add xrootd cconfig dumps to osg-system-profiler (SOFTWARE-4933)
2 parents 9e0b2cd + 6735f3a commit 783f371

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

osg-system-profiler

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,59 @@ python_info () {
134134
echo "------"
135135
}
136136

137+
138+
cconfig_dump_systemd () {
139+
local instance="$1"
140+
local executable="$2"
141+
142+
local service="${executable}@${instance}.service"
143+
local servicep="${executable}-privileged@${instance}.service"
144+
local active
145+
local activep
146+
local enabled
147+
local enabledp
148+
149+
[[ $(systemctl is-active "$service") == active ]] && active=1
150+
[[ $(systemctl is-active "$servicep") == active ]] && activep=1
151+
[[ $(systemctl is-enabled "$service") == enabled ]] && enabled=1
152+
[[ $(systemctl is-enabled "$servicep") == enabled ]] && enabledp=1
153+
154+
if [[ ! ( $active || $activep || $enabled || $enabledp ) ]]; then
155+
# This service is neither enabled nor active. Skip it; we don't care
156+
return 0
157+
fi
158+
159+
echo -n "***** XRootD cconfig for executable $executable, instance $instance ("
160+
if [[ $activep ]]; then
161+
echo -n "active (privileged)"
162+
elif [[ $active ]]; then
163+
echo -n "active"
164+
else
165+
echo -n "inactive"
166+
fi
167+
echo -n ", "
168+
if [[ $enabledp ]]; then
169+
echo -n "enabled (privileged)"
170+
elif [[ $enabled ]]; then
171+
echo -n "enabled"
172+
else
173+
echo -n "disabled"
174+
fi
175+
echo ")"
176+
177+
if [[ $enabled && $enabledp ]]; then
178+
echo "WARNING! Both $service and $servicep are enabled; this may result in conflicts"
179+
fi
180+
if [[ $active && $activep ]]; then
181+
echo "WARNING! Both $service and $servicep are active; this may result in conflicts"
182+
fi
183+
184+
cconfig -x "$executable" -h "$(hostname -f)" -n "$instance" -c "/etc/xrootd/xrootd-${instance}.cfg" 2>&1 \
185+
| grep -v "^Config continuing with file "
186+
echo
187+
}
188+
189+
137190
dir=`pwd`
138191

139192
if [ ! -w $dir ]; then
@@ -223,6 +276,17 @@ if $rpm_install; then
223276
dump_files_in_dir "/etc/osg/config.d"
224277
fi
225278

279+
# XRootD cconfig dumps for available instances
280+
if command -v cconfig &>/dev/null; then
281+
for file in /etc/xrootd/xrootd-*.cfg
282+
do
283+
instance=${file#/etc/xrootd/xrootd-}
284+
instance=${instance%.cfg}
285+
286+
cconfig_dump_systemd "$instance" "xrootd"
287+
cconfig_dump_systemd "$instance" "cmsd"
288+
done
289+
fi
226290
echo "***** Xrootd information:"
227291
for file in /etc/xrootd/xrootd-*.cfg
228292
do

0 commit comments

Comments
 (0)