Mini Shell

Direktori : /usr/share/wpos/scriptlets/
Upload File :
Current File : //usr/share/wpos/scriptlets/rpm_posttrans_wpos.sh

#!/usr/bin/bash
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2021 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT

# Note: Also called from Debian
# Arguments:

# RPM
# $1 == 1 - install package
# $1 == 2 - upgrade package

# DEB
# $1 == configure - RPM post/posttrans

# "wpos POST TRANS STARTED"


rhel=$2
_clshare=$3
clwpos_redis_extension_installer=$4
clwpos_cleaner_cron=$5
clwpos_collect_information_cron=$6
add_clwpos_crons=$7
_clshare_wpos=${8}

# migrate configs to latest ones
# FIXME: be able to use some "service" commands everywhere, currently whole utility is blocked
# it affects tests, when packages are being installed -> could be no supported edition
#cloudlinux-awp-admin migrate-configs
#{
#    "result": "Unable to run /usr/bin/cloudlinux-awp-admin utility, AccelerateWP is supported only ..",
#    "timestamp": 1705501896.0210168
#}
# /usr/bin/cloudlinux-awp-admin migrate-configs &> /dev/null &
/opt/cloudlinux/venv/bin/python3 -c "from clwpos.migrations import migrate_configs; migrate_configs()" &>/dev/null


# Setup Cloudlinux WPOS daemon
"$_clshare_wpos"/wpos_daemon_setup.py

# regenerate cron files to update their contents if needed
/usr/bin/cloudlinux-awp-admin sync-cron-files &> /dev/null

# Regenerate info.json files
nohup /usr/sbin/clwpos_collect_information.py  &> /dev/null &

# Restart WPOS daemon
/sbin/service clwpos_monitoring try-restart

# Install WPOS hooks
"$_clshare_wpos"/wpos_hooks.py --install > /dev/null

# Add to cagefs:
# - clwpos-user utility
# - /usr/bin/cloudlinux-awp-user symlink
# - file 'controlpanelname' to allow user to detect control panel
if [ -f /usr/sbin/cagefsctl ]; then
    echo -e "/usr/bin/clwpos-user\n/usr/bin/cloudlinux-awp-user\n/var/cache/controlpanelname" \
      | /usr/sbin/cagefsctl --wait-lock --update-list &> /dev/null &
fi

# only if this is an update versions before_rename -> with_rename
# /var/clwpos/admin/awp_migration_needed.v1 will be removed in code after manual admin click
# migration is not needed for those who did enable anything yet
if [[ -f /var/clwpos/admin/awp_migration.v1 ]]; then
    if cloudlinux-awp-admin get-options | grep "\"show_icon\": true" &> /dev/null; then
        touch /var/clwpos/admin/awp_migration_needed.v1
    fi
    rm -f /var/clwpos/admin/awp_migration.v1 > /dev/null
fi

# Install and update the extension for Plesk for interaction of the CloudLinux Advantage WHMCS addon
# with AccelerateWP commands
if [ -f "/usr/sbin/plesk" ]; then
  /usr/sbin/plesk bin extension -i /usr/share/cloudlinux/plesk-accelerate-wp-latest.zip &> /dev/null
  /usr/sbin/plesk bin extension --enable accelerate-wp &> /dev/null
fi

# to trigger configuration of Redis not waiting cron job
/usr/share/cloudlinux/wpos/enable_redis_for_alt_php.py &> /dev/null

# "wpos POST TRANS FINISHED"

Zerion Mini Shell 1.0