diff --git a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/rmcd.sh b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/rmcd.sh index 69d4410ec4a8c54186acede78a23e0284c0ee86e..22b7579b6ffa3fcfe06a47910ac6467918e02a0f 100755 --- a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/rmcd.sh +++ b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/rmcd.sh @@ -6,9 +6,6 @@ if [ ! -e /etc/buildtreeRunner ]; then yum-config-manager --enable cta-artifacts yum-config-manager --enable ceph yum-config-manager --enable castor - - # Install missing RPMs - yum -y install mt-st mtx lsscsi sg3_utils cta-rmcd fi # source library configuration file @@ -17,8 +14,37 @@ echo "Using this configuration for library:" cat /tmp/library-rc.sh . /tmp/library-rc.sh -# to get rmcd logs to stdout -tail -F /var/log/cta/cta-rmcd.log & - ln -s /dev/${LIBRARYDEVICE} /dev/smc -/usr/bin/cta-rmcd -f /dev/smc + + +if [ "-${CI_CONTEXT}-" == '-systemd-' ]; then + # systemd is available + +cat <<EOF >/etc/sysconfig/cta-rmcd +DAEMON_COREFILE_LIMIT=unlimited +CTA_RMCD_OPTIONS=/dev/smc +EOF + + # install RPMs? + test -e /etc/buildtreeRunner || yum -y install mt-st mtx lsscsi sg3_utils cta-rmcd + + # rmcd will be running as non root user, we need to fix a few things: + # device access rights + chmod 666 /dev/${LIBRARYDEVICE} + + echo "Launching cta-rmcd with systemd:" + systemctl start cta-rmcd + + echo "Status is now:" + systemctl status cta-rmcd + +else + # systemd is not available + # install RPMs? + test -e /etc/buildtreeRunner || yum -y install mt-st mtx lsscsi sg3_utils cta-rmcd + + # to get rmcd logs to stdout + tail -F /var/log/cta/cta-rmcd.log & + + /usr/bin/cta-rmcd -f /dev/smc +fi diff --git a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/taped.sh b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/taped.sh index cbee34bbc8f8a46f4c92df5ce1bfd4f78986d7b8..ee6e0f775101764747f3c0792d308c12519d8c35 100755 --- a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/taped.sh +++ b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/taped.sh @@ -17,9 +17,6 @@ cat /tmp/library-rc.sh . /tmp/library-rc.sh ln -s /dev/${LIBRARYDEVICE} /dev/smc -#/usr/bin/rmcd -f /dev/smc& - -mkdir -p /etc/castor tpconfig="${DRIVENAMES[${driveslot}]} ${LIBRARYNAME} /dev/${DRIVEDEVICES[${driveslot}]} smc${driveslot}" @@ -30,7 +27,7 @@ echo "Configuring database" /opt/run/bin/init_database.sh . /tmp/database-rc.sh -echo ${DATABASEURL} >/etc/cta/cta-catalogue.conf +echo ${DATABASEURL} > /etc/cta/cta-catalogue.conf # cta-taped setup echo "taped BufferCount 10" > /etc/cta/cta-taped.conf @@ -38,7 +35,6 @@ echo ${DATABASEURL} >/etc/cta/cta-catalogue.conf echo "ObjectStore BackendPath $OBJECTSTOREURL" >> /etc/cta/cta-taped.conf echo "${tpconfig}" > /etc/cta/TPCONFIG - #### # configuring taped using the official location for SSS: /etc/cta/cta-taped.sss.keytab CTATAPEDSSS="cta-taped.sss.keytab" @@ -50,24 +46,34 @@ chmod 600 /etc/cta/${CTATAPEDSSS} chown cta /etc/cta/${CTATAPEDSSS} cat <<EOF > /etc/sysconfig/cta-taped -export CTA_TAPED_OPTIONS="--foreground -l /var/log/cta/cta-taped.log" +CTA_TAPED_OPTIONS="--log-to-file=/var/log/cta/cta-taped.log" +XrdSecPROTOCOL=sss +XrdSecSSSKT=/etc/cta/${CTATAPEDSSS} +EOF -export XrdSecPROTOCOL=sss -export XrdSecSSSKT=/etc/cta/${CTATAPEDSSS} +if [ "-${CI_CONTEXT}-" == '-systemd-' ]; then + # systemd is available + echo "Launching rmcd with systemd:" + systemctl start cta-taped -EOF + echo "Status is now:" + systemctl status cta-taped -. /etc/sysconfig/cta-taped +else + # systemd is not available +. /etc/sysconfig/cta-taped tail -F /var/log/cta/cta-taped.log & # cta-taped is ran with runuser to avoid a bug with Docker that prevents both # the setresgid(-1, 1474, -1) and setresuid(-1, 14029, -1) system calls from # working correctly -runuser -c "/usr/bin/cta-taped ${CTA_TAPED_OPTIONS}" +runuser -c "/usr/bin/cta-taped --foreground ${CTA_TAPED_OPTIONS}" echo "taped died" sleep infinity + +fi diff --git a/continuousintegration/docker/ctafrontend/cc7/rc.local.shared b/continuousintegration/docker/ctafrontend/cc7/rc.local.shared index 25793c0c4685419b948647b451982ce40f3c1794..c21a1097d463e928c33a31d8abb8d6bee57a9d03 100755 --- a/continuousintegration/docker/ctafrontend/cc7/rc.local.shared +++ b/continuousintegration/docker/ctafrontend/cc7/rc.local.shared @@ -22,9 +22,20 @@ printenv > /tmp/rc.local.shared -logfile="/var/log/${MY_NAME}.log" +logfile="/var/log/${MY_NAME}-${MY_CONTAINER}.log" if [ $(echo ${MY_NAME} | grep -s '^ctafrontend') ]; then - echo "Running /shared/ctafrontend.sh" &> ${logfile} + echo "Running /opt/run/bin/ctafrontend.sh" &> ${logfile} /opt/run/bin/ctafrontend.sh 2>&1 | tee -a ${logfile} fi + +if [ $(echo ${MY_CONTAINER} | grep -s '^rmcd') ]; then + echo "Running /opt/run/bin/rmcd.sh" &> ${logfile} + /opt/run/bin/rmcd.sh 2>&1 | tee -a ${logfile} +fi + +if [ $(echo ${MY_CONTAINER} | grep -s '^taped') ]; then + echo "Running /opt/run/bin/taped.sh" &> ${logfile} + /opt/run/bin/taped.sh 2>&1 | tee -a ${logfile} +fi +