Skip to content
Snippets Groups Projects
Commit 122c7771 authored by Christoph Heidecker's avatar Christoph Heidecker Committed by root
Browse files

Added systemd service files

parent 7dc95c4b
Branches
No related tags found
No related merge requests found
# ignore cache, tmp, xrootd and xrdbuild directory
/*
!/config
!/systemd
!/*.*
*.root
#!/bin/bash
#
# Service script for XRootD caching services
# ----------------------------------------
# Service instance name
INSTANCE="XRootD"
# XRootD installation path
XRD_PATH=/opt/XRootD
# XRootD logging directory
LOGDIR=/var/log/XRootD
# Service PID file
PIDFILE=/var/run/xrootd.pid
# Adding libraries to enironment variable
export LD_LIBRARY_PATH=$XRD_PATH/xrootd/lib64:$LD_LIBRARY_PATH
export PATH=$XRD_PATH/xrootd/bin:$PATH
# Starting command for XRootD services
COMMAND="su xrootd -c 'xrootd -c $XRD_PATH/configs/proxy-manager.cf -l=$LOGDIR/proxy-manager/xrootd.log -k 100m &' ; su xrootd -c 'cmsd -c $XRD_PATH/configs/proxy-manager.cf -l=/logs/proxy-manager/cmsd.log -k 100m &'"
# Check for running service processes
if [ -f $PIDFILE ]
then
PID=`cat $PIDFILE`
fi
case "$1" in
'start')
if [ -f $PIDFILE ] ; then
if test `ps -e | grep -c $PID` = 1; then
echo "Not starting $INSTANCE - instance already running with PID: $PID"
else
echo "Starting $INSTANCE"
#echo "Starting $INSTANCE" > $LOGDIR
cd $PDIR
nohup $COMMAND &>> /dev/null &
#nohup $COMMAND &>> $LOGDIR &
echo $! > $PIDFILE
fi
else
echo "Starting $INSTANCE"
#echo "Starting $INSTANCE" > $LOGDIR
cd $PDIR
nohup $COMMAND &>> /dev/null &
#nohup $COMMAND &>> $LOGDIR &
echo $! > $PIDFILE
fi
;;
'stop')
if [ -f $PIDFILE ] ; then
echo "stopping $INSTANCE"
#echo "stopping $INSTANCE" >> $LOGDIR
kill -15 $PID
else
echo "Cannot stop $INSTANCE - no Pidfile found!"
fi
;;
'restart')
$0 stop
sleep 5
$0 start
;;
'status')
if [ -f $PIDFILE ] ; then
if test `ps -e | grep -c $PID` = 0; then
echo "$INSTANCE not running"
else
echo "$INSTANCE running with PID: [$PID]"
fi
else
echo "$PIDFILE does not exist! Cannot process $INSTANCE status!"
exit 1
fi
;;
*)
echo "usage: $0 { start | stop | restart | status }"
;;
esac
exit 0
[Unit]
Description=XRootD-Services
After=syslog.target network.target
Wants=network.target
[Service]
Type=simple
RemainAfterExit=yes
ExecStart=/bin/sh /opt/XRootD/systemd/xrootd-daemon.sh start
ExecStop=/bin/sh /opt/XRootD/systemd/xrootd-daemon.sh stop
[Install]
WantedBy=multi-user.target
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment