PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` #!/bin/bash ## i360deploy INFO # Short Description :Deploy imunify360 Agent # Description :Installs imunify360 repository # Copyright :Cloud Linux Zug GmbH # License :Cloud Linux Commercial License ## i360deploy INFO version="1.4.1" set -o pipefail # fail if any error: will not #set -e # error for unbound variable: not for now #set -eu run_with_retries() { cmd=$1 expected_error_text=$2 timeout=15 nattempts=10 for ((i=1;i<=nattempts;i++)); do output=$( { $cmd ; } 2>&1 ) res=$? if [ $res -eq 0 ]; then echo "$output" break else if echo "$output" | grep -q "$expected_error_text"; then echo "$output" echo -n "Attempt #$i/$nattempts: to run $cmd." [ $i -ne $nattempts ] && echo "Retrying in $timeout seconds.." sleep $timeout else echo "$output" break fi fi done return $res } init_vars() { scriptname="i360deploy.sh" log=/var/log/${scriptname%.*}.log lock=/var/lock/${scriptname%.*}.lck wget="/usr/bin/wget" wget_options="-q" uninstall=false conversion=false beta=false NO_ARGS=0 # Update checker URL checksite="https://repo.imunify360.cloudlinux.com/defense360/" checksite_forcurl='https://defense360:nraW!F%40%24x4Xd6HHQ@repo.imunify360.cloudlinux.com/defense360/' upgradeurl="$checksite$scriptname" script="$scriptname" dry_run="0" script="$1" case "$script" in ./*) script="`pwd`/`basename $script`" ;; /*) script="$script" ;; *) script="`pwd`/$script" ;; esac script_run_args="$2" assumeyes=false modifying_call=false yum_beta_option="" yum_beta_repo_enable=0 apt_allow_unauthenticated="" # Virtuozzo 7 with kernel 3.10.0 or later has support for ipset in Container VZ_VERSION_LONG=3.10.0-327.10.1.vz7.12.8 # Inside VZ version is provided without release VZ_VERSION_BRIEF=3.10.0 datadir=/opt/alt/python35/share/imunify360 installable_pkgs="imunify360-firewall imunify360-firewall-cpanel imunify360-firewall-directadmin" } reopen_log() { echo "-- $(date -R): $script $script_run_args --" >> $log chmod 0600 $log } detect_ostype() { echo -n "Detecting ostype... " if [ ! -f /etc/os-release ] then ostype=centos else source /etc/os-release if echo $ID $ID_LIKE | grep debian >/dev/null then ostype=debian else ostype=centos fi fi echo $ostype } check_debian_pkg_presence() { test "$(dpkg-query --show --showformat='${db:Status-Status}\n' $1 2>/dev/null)" = "installed" } check_centos_pkg_presence() { rpm --query $1 >/dev/null } remove_debian_imunify() { apt-get remove --autoremove --dry-run imunify360-firewall yesno "apt-get --AUTOREMOVE to remove imunify360-firewall plus \ aforementioned packages [y] or just imunify360-firewall [n]" if [ $? == 0 ]; then local autoremove="--autoremove" else local autoremove="" fi apt-get remove $autoremove -y imunify360-firewall } remove_centos_imunify() { local yum_phprepo_option=--disablerepo=imunify360-alt-php,imunify360-ea-php-hardened yum remove -y $yum_beta_option $yum_phprepo_option \ imunify360-firewall --setopt=clean_requirements_on_remove=1 } install_debian_pkgs() { pkgs=$@ run_with_retries "apt-get install -y $apt_allow_unauthenticated $pkgs" "Could not get lock" } install_centos_pkgs() { local yum_phprepo_option=--disablerepo=imunify360-alt-php,imunify360-ea-php-hardened yum install -y $yum_beta_option $yum_phprepo_option $@ } install_debian_ipset() { apt-get install -y ipset } install_centos_ipset() { yum install -y ipset } detect_first_install() { if check_${ostype}_pkg_presence imunify360-firewall >/dev/null then first_install=false else first_install=true fi } is_systemctl_avail() { which systemctl >/dev/null 2>&1 } exit_with_error() { echo "$@" | tee -a $log rm -rf $lock exit 1 } check_exit_code() { if [ $? -ne $1 ]; then exit_with_error "$2"; fi; } check_pipestatus() { if [ $PIPESTATUS -ne $1 ]; then exit_with_error $2; fi; } yesno() # $1 = Message prompt # Returns ans=0 for yes, ans=1 for no { local YES=0 local NO=1 local PENDING=2 if [ $dry_run -eq 1 ] then echo "Would be asked here if you wanted to" echo "$1 (y/n - y is assumed)" local ans=$YES elif [ "$assumeyes" = "true" ]; then local ans=$YES else local ans=$PENDING fi while [ $ans -eq $PENDING ] do echo -n "Do you want to $1 (y/n) ?" ; read reply case "$reply" in Y*|y*) ans=$YES ;; N*|n*) ans=$NO ;; *) echo "Please answer y or n" ;; esac done return "$ans" } download_file() # $1 = Full URL to download # $2 = Optional basename to save to (if omitted, then = basename $1) # Also allow download to fail without exit if $2 is set { if [ "$2" = "" ] then dlbase="`basename \"$1\"`" else dlbase="$2" fi if [ $dry_run -eq 1 ] then echo "Would download this URL to $tmp_tree/$dlbase :" echo $1 ; echo return fi old_dlbase="$dlbase.old" if [ -f "$dlbase" ] then rm -f "$old_dlbase" mv -f "$dlbase" "$old_dlbase" fi echo "Downloading $dlbase (please wait)" $wget $wget_options -O "$dlbase" "$1" if [ ! -s "$dlbase" ] then if [ -f "$old_dlbase" ] then mv -f "$old_dlbase" "$dlbase" fi if [ "$2" = "" ] then echo "Failed to download $dlbase" rm -f $lock exit 1 fi fi } check_version() # Make sure that we are running the latest version # $* = Params passed to script { echo "Checking for an update to $scriptname" script_from_repo=$scriptname".repo_version" download_file "$upgradeurl" "$script_from_repo" newversion=`grep "^version=" $script_from_repo | sed 's/[^0-9.]*//g'` if [ $dry_run -eq 1 ] then echo "Would check if this running script (version $version) is out of date." echo "If it's been superseded, the new version would be downloaded and you'd be asked" echo "if you want to upgrade to it and run the new version." echo return fi if [ $(echo -e "$version\n$newversion" | sort --reverse --version-sort | head -1) = $version ] then echo "$scriptname is already the latest version ($version) - continuing" rm -f $script_from_repo else echo "New version ($newversion) of $scriptname detected" if yesno "run $scriptname $newversion now" then echo "OK, executing $script_from_repo $*" mv -f $script_from_repo $scriptname chmod u+x "$scriptname" echo "Download of $scriptname $newversion successful" rm $lock echo "Run $script $script_run_args" exec "$script" --skip-version-check $script_run_args error "Failed to run $script $script_run_args" else echo "New version of script is available: $upgradeurl" echo "It was downloaded to $script_from_repo" echo "If you prefer to use current version, run it with \"--skip-version-check\" key." exit 1 fi fi } save_debian_repo() { apt-key adv --fetch-keys http://repo.cloudlinux.com/cloudlinux/security/RPM-GPG-KEY-CloudLinux echo 'deb https://repo.imunify360.cloudlinux.com/imunify360/ubuntu/16.04/ xenial main' \ > /etc/apt/sources.list.d/imunify360.list if [ "$beta" = "true" ]; then echo 'deb https://repo.imunify360.cloudlinux.com/imunify360/ubuntu-testing/16.04/ xenial main' \ > /etc/apt/sources.list.d/imunify360-testing.list fi if ! apt-get update 2>&1 | tee -a $log then test "$dev_install" = true check_exit_code 0 "apt-get update error." fi } save_centos_repo() { local RPM_KEY=$checksite/RPM-GPG-KEY-CloudLinux local RPM_KEY_forcurl=$checksite_forcurl/RPM-GPG-KEY-CloudLinux cat >/etc/yum.repos.d/imunify360.repo <<-EOF [imunify360] name=EL-$1 - Imunify360 baseurl=$checksite/el/$1/updates/x86_64/ username=defense360 password=nraW!F@\$x4Xd6HHQ enabled=1 gpgcheck=1 gpgkey=$RPM_KEY EOF # add testing repo as disabled by default cat >/etc/yum.repos.d/imunify360-testing.repo <<-EOF [imunify360-testing] name=EL-$1 - Imunify360 baseurl=$checksite/el/$1/updates-testing/x86_64/ username=defense360 password=nraW!F@\$x4Xd6HHQ enabled=$yum_beta_repo_enable gpgcheck=1 gpgkey=$RPM_KEY EOF rpm --import "$RPM_KEY_forcurl" 2>&1 | tee -a $log check_exit_code 0 "RPM import error." modifying_call=true } remove_debian_repo() { rm /etc/apt/sources.list.d/imunify360.list \ /etc/apt/sources.list.d/imunify360-testing.list \ /etc/apt/sources.list.d/imunify360-alt-php.list 2>/dev/null } remove_centos_repo() { rm /etc/yum.repos.d/imunify360.repo \ /etc/yum.repos.d/imunify360-testing.repo \ /etc/yum.repos.d/imunify360-ea-php-hardened \ /etc/yum.repos.d/imunify360-alt-php 2>/dev/null } remove_acronis_agent() { [ ! -e /usr/bin/restore_infected ] && return if /usr/bin/restore_infected acronis extra is_installed 2> /dev/null then if yesno "remove Acronis agent" then /usr/bin/restore_infected acronis extra uninstall > /dev/null || : fi fi } version() { local lhs=$1 local op=$2 local rhs=$3 case $op in -lt) test "$(echo -e $lhs\\n$rhs | sort --version-sort | head -1)" = $lhs && \ test $lhs != $rhs return $? ;; *) echo "function version(): operator $op is not supported." return 2 ;; esac } check_debian_release () { source /etc/os-release if [ "$VERSION_ID" != 16.04 ] then exit_with_error "You are running unsupported version of debian based OS. Imunify360 supports only Ubuntu 16.04" fi if [ $(uname -m) != x86_64 ] then exit_with_error "You are running 32bit version of OS. Imunify360 supports only 64bit version" fi } check_centos_release () { rpm -q --whatprovides redhat-release > /dev/null 2>&1 check_exit_code 0 "There is no package providing /etc/redhat-release, please install redhat-release or centos-release first" ARCH=$(uname -i) # handle 32bit xen with x86_64 host kernel if (!rpm -q glibc.x86_64 > /dev/null 2>&1) || [ "$ARCH" != "x86_64" ] ; then exit_with_error "You are running 32bit version of OS. Imunify360 supports only 64bit version" fi OS_VERSION="$(rpm -q --qf %{version} `rpm -q --whatprovides redhat-release` | cut -c 1)" if [ "$OS_VERSION" -eq "5" ]; then exit_with_error "Version 5 is not supported, only CentOS/CloudLinux 6 and 7 are supported at the moment" elif [ "$OS_VERSION" -eq "6" ]; then : elif [ "$OS_VERSION" -eq "7" ]; then : fi if [ "$OS_VERSION" != 5 ] && [ "$OS_VERSION" != 6 ] && [ "$OS_VERSION" != 7 ]; then exit_with_error "Only CentOS/CloudLinux 6 and 7 are supported at the moment" elif [ -f /proc/vz/vestat ]; then if version "$(uname -r)" -lt $VZ_VERSION_BRIEF; then echo "You are inside VZ." echo "Virtuozzo 7 with kernel $VZ_VERSION_LONG or later has support for ipset in Containers." exit_with_error "Please upgrade your OpenVZ hypervisor kernel version to $VZ_VERSION_LONG or later." fi fi } backup () { # Nothing to backup so far. : } debian_prep () { apt-get clean 2>&1 | tee -a $log : } centos_prep () { yum clean all $yum_beta_option 2>&1 | tee -a $log : } check_panel () { PANEL="" ROOT_PLESK_DIR="/usr/local/psa/admin/" ROOT_CPANEL_DIR="/usr/local/cpanel/whostmgr/docroot/" ROOT_IWORX_DIR="/usr/local/interworx/" ROOT_ISPMGR_DIR="/usr/local/ispmgr/" ROOT_DA_DIR="/usr/local/directadmin/" if [ -d $ROOT_PLESK_DIR ]; then PANEL="plesk"; fi if [ -d $ROOT_IWORX_DIR ]; then PANEL="interworx"; fi if [ -d $ROOT_CPANEL_DIR ]; then PANEL="cpanel"; fi if [ -d $ROOT_ISPMGR_DIR ]; then PANEL="ispmgr"; fi if [ -d $ROOT_DA_DIR ]; then PANEL="directadmin"; fi if [ "$PANEL" != "" ] && [ "$PANEL" = "cpanel" ] && [ -x /usr/local/cpanel/cpanel ] ; then CPANEL_MAJOR=`/usr/local/cpanel/cpanel -V | cut -f 1 -d "."` CPANEL_MINOR=`/usr/local/cpanel/cpanel -V | cut -f 2 -d "."` if [ $CPANEL_MAJOR -eq 11 ] && [ $CPANEL_MINOR -lt 30 ]; then CPANEL_OLD=YES else CPANEL_OLD=NO fi fi if [ "$PANEL" != "" ] && [ "$PANEL" = "plesk" ] && [ -f /usr/local/psa/version ] ; then PLESK_MAJOR=`cut -f 1 -d "." /usr/local/psa/version` PLESK_MINOR=`cut -f 2 -d "." /usr/local/psa/version` if [ $PLESK_MAJOR -eq 11 ] && [ $PLESK_MINOR -lt 5 ]; then PLESK_OLD=YES else PLESK_OLD=NO fi fi } check_users() { CHECK_GROUPS="ossec" CHECK_USERS="ossec ossecr ossecm ossece" SYS_GID_MAX=`cat /etc/login.defs | grep '^SYS_GID_MAX' | tr -d 'SYS_GID_MAX' | tr -d ' '` SYS_UID_MAX=`cat /etc/login.defs | grep '^SYS_UID_MAX' | tr -d 'SYS_UID_MAX' | tr -d ' '` # detect SYS_GID_MAX, SYS_UID_MAX indirectly (Ubuntu 16.04) GID_MIN=`cat /etc/login.defs | grep '^GID_MIN' | tr -d 'GID_MIN' | tr -d ' '` UID_MIN=`cat /etc/login.defs | grep '^UID_MIN' | tr -d 'UID_MIN' | tr -d ' '` if [ "$SYS_GID_MAX" = "" -a "$GID_MIN" != "" ]; then SYS_GID_MAX=$(($GID_MIN - 1)) fi if [ "$SYS_UID_MAX" = "" -a "$UID_MIN" != "" ]; then SYS_UID_MAX=$(($UID_MIN - 1)) fi for grp in $CHECK_GROUPS; do gid=`getent group $grp 2> /dev/null | cut -d ':' -f 3` if [ -z "$gid" ]; then gid='-1' fi if [ "$SYS_GID_MAX" != "" ]; then if [ "$gid" -gt "$SYS_GID_MAX" ]; then exit_with_error "Non-system group $grp already exists" fi elif [ "$first_install" = "true" -a "$gid" != "-1" ]; then exit_with_error "Group $grp already exists" fi done for usr in $CHECK_USERS; do uid=`id -u $usr 2>/dev/null || echo -1` if [ "$SYS_UID_MAX" != "" ]; then if [ "$uid" -gt "$SYS_UID_MAX" ]; then exit_with_error "Non-system user $usr already exists" fi elif [ "$first_install" = "true" -a "$uid" != "-1" ]; then exit_with_error "User $usr already exists" fi done } remove_hardened_php_repos() { if [[ $ostype = centos ]]; then ALT_PHP=imunify360-alt-php.repo EA_PHP=imunify360-ea-php-hardened.repo REPOS_DIR=/etc/yum.repos.d # fix permissions for REPO in $ALT_PHP $EA_PHP; do test -f $REPOS_DIR/$REPO || continue chattr -i $REPOS_DIR/$REPO chmod 644 $REPOS_DIR/$REPO done # remove unconditionally rm -f $REPOS_DIR/$ALT_PHP rm -f $REPOS_DIR/$EA_PHP fi } print_help () { cat << EOF >&2 Usage: -h, --help Print this message -k, --key Deploy Imunify360 Agent with activation key -c, --uninstall Uninstall Imunify360 Agent --skip-version-check Do not check for script updates --skip-registration Do not register, just install (the default) --dev-install Turn off software defect reporting --beta Install packages from 'testing' repo -y, --yes Assume "yes" as answer to all prompts and run non-interactively EOF } # Lets start init_vars $0 "$*" reopen_log if [ -f $lock ] ; then if [ -d /proc/$(cat $lock) ] ; then exit_with_error "$scriptname is already running" fi fi echo $$ > $lock check_exit_code 0 "Please run $scriptname as root" options=`getopt -o ychk: -l yes,uninstall,help,skip-version-check,skip-registration,beta,dev-install,key: -- "$@"` if [ $? != 0 ] ; then print_help ; rm -f $lock; exit 1 ; fi eval set -- "$options" while true; do case "$1" in -h|--help) print_help rm -f $lock exit 0 ;; -y|--yes) assumeyes=true shift ;; -c|--uninstall) uninstall=true shift ;; -k|--key) conversion=true activationkey="$2" shift 2 ;; --skip-version-check) skipversioncheck=true shift ;; --skip-registration) registration=false shift ;; --beta) beta=true yum_beta_option="--enablerepo=imunify360-testing" yum_beta_repo_enable=1 shift ;; --dev-install) dev_install=true apt_allow_unauthenticated=--allow-unauthenticated shift ;; --) shift break ;; -*) echo "$0: error - unrecognized option $1" 1>&2 print_help rm -f $lock exit 1 ;; *) exit_with_error "Internal error!" ;; esac done detect_ostype check_${ostype}_release detect_first_install check_users remove_hardened_php_repos if [ "$skipversioncheck" = "true" ]; then echo "Skipping check version" else check_version fi if [ "$conversion" = "true" ] && [ "$uninstall" = "true" ] ; then exit_with_error "invalid combination"; fi if [ "$conversion" = "false" -a "$registration" != "false" ] ; then # Register by IP is the default now conversion=true activationkey=false fi check_panel if [[ $uninstall == "true" ]]; then remove_acronis_agent remove_${ostype}_imunify 2>&1 | tee -a $log # if ls /opt/alt/php*/usr/bin/php > /dev/null 2>&1 ; then # echo "alt-php installed, erasing" 2>&1 | tee -a $log # yum -y groupremove alt-php 2>&1 | tee -a $log # fi # # if ls /opt/alt/python*/bin/python > /dev/null 2>&1; then # echo "alt-python installed, erasing" 2>&1 | tee -a $log # yum -y erase alt-python* 2>&1 | tee -a $log # fi remove_${ostype}_repo echo "Uninstall complete." | tee -a $log exit 0 fi if ! check_${ostype}_pkg_presence ipset then install_${ostype}_ipset 2>&1 | tee -a $log check_exit_code 0 "Package ipset was not installed." fi if ! ipset list -n -t >/dev/null then exit_with_error "Your OS virtualization technology $(systemd-detect-virt 2>/dev/null || virt-what >/dev/null || echo of unknown type) has limited support for ipset in containers. Please, contact Imunify360 Support Team." fi if check_${ostype}_pkg_presence imunify-antivirus; then echo "You are about to uninstall ImunifyAV and install Imunify360 that includes Malware Scanner. To get ImunifyAV back run the following commands: # yum remove 'imunify360-firewall*' # wget https://repo.imunify360.cloudlinux.com/defence360/av-deploy.sh # bash ./av-deploy.sh" if yesno "Do you agree to proceed with uninstalling ImunifyAV?"; then yum remove -y 'imunify-antivirus*' else exit 1 fi fi if [ "$first_install" = "true" ]; then echo "In a few moments the script will install latest imunify360-firewall" \ "package (w/dependencies)... (Ctrl-C to cancel)" sleep 4 save_${ostype}_repo $OS_VERSION install_${ostype}_pkgs imunify360-firewall 2>&1 | tee -a $log check_exit_code 0 "Package imunify360-firewall was not installed." modifying_call=true fi # install cPanel/Plesk plugin if [ "$PANEL" = "ispmanager" ] || [ "$PANEL" = "interworx" ] ; then : # pass elif [ "$PANEL" = "plesk" ] ; then if ! /usr/local/psa/bin/server_pref --show-web-app-firewall 2>&1 > /dev/null; then echo "Installing mod_security" | tee -a $log run_with_retries "plesk installer --select-release-current --install-component modsecurity" "operation was locked" | tee -a $log fi install_${ostype}_pkgs imunify360-firewall-plesk | tee -a $log check_exit_code 0 "Failed to install Imunify360 Plesk plugin." modifying_call=true if [ "$PLESK_OLD" = "YES" ] ; then : # pass fi elif [ "$PANEL" = "cpanel" ] ; then echo "Installing Imunify360 cPanel plugin..." | tee -a $log install_${ostype}_pkgs imunify360-firewall-cpanel 2>&1 | tee -a $log check_exit_code 0 "Failed to install Imunify360 cPanel plugin." modifying_call=true elif [ "$PANEL" = "directadmin" ] ; then pushd /usr/local/directadmin/custombuild/ da_webserver="$(grep ^webserver= options.conf | sed s/webserver=//)" da_modsecurity="$(grep ^modsecurity= options.conf | sed s/modsecurity=//)" if [ "$da_webserver" != apache -a "$da_webserver" != litespeed ] then echo "Imunify modsecurity ruleset is not supported for $da_webserver webserver." else if [ "$da_modsecurity" != yes ]; then echo "Installing DirectAdmin modsecurity..." | tee -a $log # create options.conf backup file before edit # with name e.g. options.conf.bak_2018-03-29.1522323911 sed -i.bak_$(date +%F.%s) \ -e "s/^modsecurity=.*/modsecurity=yes/" \ -e "s/^modsecurity_ruleset=.*/modsecurity_ruleset=no/" options.conf ./build modsecurity else echo "Installing DirectAdmin modsecurity... already installed!" | tee -a $log fi modifying_call=true fi popd echo "Installing Imunify360 DirectAdmin plugin..." | tee -a $log # Disabling ea\alt-php repos as far as, repo.alt.cloudlinux.com # requires a few minutes to register the new server_id. That # happens, because the repos was generated just a few seconds ago # while agent registration. # Only after some period of time that the repos became valid. install_${ostype}_pkgs imunify360-firewall-directadmin 2>&1 | tee -a $log check_exit_code 0 "Failed to install Imunify360 DirectAdmin plugin." else : # pass fi if [ "$conversion" = "true" ] ; then backup ${ostype}_prep echo -n "Checking if has already been registered... " | tee -a $log imunify360-agent --console-log-level ERROR rstatus | tee -a $log rstatus=$? if [ "$rstatus" = 11 ] ; then exit_with_error "Registration server general error." fi if [ "$rstatus" = 0 -a "$activationkey" != false ] ; then echo -n "Unregister the previous registration key... " | tee -a $log imunify360-agent --console-log-level WARNING unregister 2>&1 | tee -a $log fi if [ "$activationkey" != false ] ; then echo -n "Register by key... " | tee -a $log imunify360-agent --console-log-level WARNING register "$activationkey" 2>&1 | tee -a $log check_exit_code 0 "Registration was not successful. Exiting." elif [ "$rstatus" != 0 ] ; then # "$rstatus" != 0 check because it is no sense to re-register # by IP (in comparison with re-register by activation key) echo -n "Register by IP... " | tee -a $log imunify360-agent --console-log-level WARNING register IPL 2>&1 | tee -a $log check_exit_code 0 "Registration was not successful. Exiting." fi echo "Successfully registered" | tee -a $log $datadir/scripts/disable_3rd_party_ids if is_systemctl_avail then systemctl start imunify360 >&1 | tee -a $log else /sbin/service imunify360 start >&1 | tee -a $log fi check_exit_code 0 "Failed to start imunify360 service." agent_start_success=false echo "Wait for Imunify360 to start..." for i in {1..10} do is_running=$(ps -ef | grep -v grep | grep imunify360-agent | wc -l) if [[ $is_running == 0 ]]; then sleep 60 continue fi imunify360-agent version >/dev/null 2>&1 if [[ $? == 0 ]]; then echo "Imunify360 is started" | tee -a $log agent_start_success=true break else sleep 60 fi done if ! $agent_start_success; then echo "Something went wrong during Imunify360 start up" | tee -a $log exit_with_error "See /var/log/imunify360/error.log for details" fi elif ! imunify360-agent rstatus >/dev/null 2>&1 then echo "You have to register this software with registration key:" | tee -a $log echo " $script --key " | tee -a $log fi if $modifying_call; then echo "Success" | tee -a $log echo "You can find complete log in /var/log/${scriptname%.*}.log" fi rm -f $lock exit 0