Skip to content

Commit

Permalink
Add/clean crontabs for VOCMS machines (kinit)
Browse files Browse the repository at this point in the history
  • Loading branch information
nothingface0 committed Jun 12, 2024
1 parent 6aed618 commit 6b58acf
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions deploy_dqmgui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,38 @@ check_dependencies() {
echo "INFO: All required packages are installed"
}

# Clean VOCMS-specific crontabs
_clean_crontab_vocms() {
FLAVOR="${SPECIAL_HOSTS[$HOST]}"
if [ -z "$FLAVOR" ]; then
echo "INFO: Not a vocms machine, not cleaning vocms crontabs"
return
fi
crontab -l 2>/dev/null | grep -v "$INSTALLATION_DIR/current/config/admin/kinit.sh" | crontab -
}

# Remove existing DQMGUI cronjobs
clean_crontab() {
# Filter cronjobs starting in $INSTALLATION_DIR/current/dqmgui and
# replace crontabs
crontab -l 2>/dev/null | grep -v "HOME=/tmp" | grep -v "$INSTALLATION_DIR/current/config/dqmgui" | grep -vE "$INSTALLATION_DIR/current.+logrotate.conf" | crontab -
}

# Crontabs specific to VOCMS
_install_crontab_vocms() {
FLAVOR="${SPECIAL_HOSTS[$HOST]}"
if [ -z "$FLAVOR" ]; then
echo "INFO: Not a vocms machine, not installing vocms crontabs"
return
fi
(
crontab -l # Get existing crontabs
# Adding kinit script for EOS
echo "*/6 * * * * $INSTALLATION_DIR/current/config/admin/kinit.sh"
echo "@reboot $INSTALLATION_DIR/current/config/admin/kinit.sh"
) | crontab -
}

# Install DQMGUI cronjobs
install_crontab() {
_create_logrotate_conf
Expand All @@ -125,11 +150,12 @@ install_crontab() {
echo "HOME=/tmp" # Workaround for P5, where the home dir is an NFS mount and isn't immediately available.
echo "@reboot (sleep 30 && $INSTALLATION_DIR/current/config/dqmgui/manage sysboot)"
) | crontab -
_install_crontab_vocms
}

# Clean acrontabs for Offline/RelVal/Dev GUI
clean_acrontab() {
FLAVOR="${SPECIAL_HOSTS[$HOST]}" # TODO: Get flavor
FLAVOR="${SPECIAL_HOSTS[$HOST]}"
if [ -z "$FLAVOR" ]; then
echo "INFO: Not a vocms machine, not cleaning acrontabs"
return
Expand Down Expand Up @@ -306,8 +332,9 @@ extract_dmwm() {

install_dmwm() {
# Move dqmgui-related scripts from DMWM to the config folder
rm -rf "$INSTALLATION_DIR/$DMWM_GIT_TAG/config/dqmgui" # Cleanup dir if exists
mv "$DMWM_TMP_DIR/dqmgui" "$INSTALLATION_DIR/$DMWM_GIT_TAG/config/dqmgui"
rm -rf "$INSTALLATION_DIR/$DMWM_GIT_TAG/config/dqmgui" # Cleanup dir if exists
mv "$DMWM_TMP_DIR/dqmgui" "$INSTALLATION_DIR/$DMWM_GIT_TAG/config/dqmgui" # DQMGUI Layouts
mv "$DMWM_TMP_DIR/admin" "$INSTALLATION_DIR/$DMWM_GIT_TAG/config/admin" # Needed for kinit.sh
rm -rf $DMWM_TMP_DIR
}

Expand Down

0 comments on commit 6b58acf

Please sign in to comment.