D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
proc
/
thread-self
/
root
/
home
/
vblioqus
/
karachi777.vip
/
in
/
106014
/
900508
/
Filename :
misc.tar
back
Copy
cxl.h 0000644 00000007540 15153557020 0005514 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* * Copyright 2014 IBM Corp. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #ifndef _MISC_CXL_H #define _MISC_CXL_H #include <linux/types.h> #include <linux/ioctl.h> struct cxl_ioctl_start_work { __u64 flags; __u64 work_element_descriptor; __u64 amr; __s16 num_interrupts; __u16 tid; __s32 reserved1; __u64 reserved2; __u64 reserved3; __u64 reserved4; __u64 reserved5; }; #define CXL_START_WORK_AMR 0x0000000000000001ULL #define CXL_START_WORK_NUM_IRQS 0x0000000000000002ULL #define CXL_START_WORK_ERR_FF 0x0000000000000004ULL #define CXL_START_WORK_TID 0x0000000000000008ULL #define CXL_START_WORK_ALL (CXL_START_WORK_AMR |\ CXL_START_WORK_NUM_IRQS |\ CXL_START_WORK_ERR_FF |\ CXL_START_WORK_TID) /* Possible modes that an afu can be in */ #define CXL_MODE_DEDICATED 0x1 #define CXL_MODE_DIRECTED 0x2 /* possible flags for the cxl_afu_id flags field */ #define CXL_AFUID_FLAG_SLAVE 0x1 /* In directed-mode afu is in slave mode */ struct cxl_afu_id { __u64 flags; /* One of CXL_AFUID_FLAG_X */ __u32 card_id; __u32 afu_offset; __u32 afu_mode; /* one of the CXL_MODE_X */ __u32 reserved1; __u64 reserved2; __u64 reserved3; __u64 reserved4; __u64 reserved5; __u64 reserved6; }; /* base adapter image header is included in the image */ #define CXL_AI_NEED_HEADER 0x0000000000000001ULL #define CXL_AI_ALL CXL_AI_NEED_HEADER #define CXL_AI_HEADER_SIZE 128 #define CXL_AI_BUFFER_SIZE 4096 #define CXL_AI_MAX_ENTRIES 256 #define CXL_AI_MAX_CHUNK_SIZE (CXL_AI_BUFFER_SIZE * CXL_AI_MAX_ENTRIES) struct cxl_adapter_image { __u64 flags; __u64 data; __u64 len_data; __u64 len_image; __u64 reserved1; __u64 reserved2; __u64 reserved3; __u64 reserved4; }; /* ioctl numbers */ #define CXL_MAGIC 0xCA /* AFU devices */ #define CXL_IOCTL_START_WORK _IOW(CXL_MAGIC, 0x00, struct cxl_ioctl_start_work) #define CXL_IOCTL_GET_PROCESS_ELEMENT _IOR(CXL_MAGIC, 0x01, __u32) #define CXL_IOCTL_GET_AFU_ID _IOR(CXL_MAGIC, 0x02, struct cxl_afu_id) /* adapter devices */ #define CXL_IOCTL_DOWNLOAD_IMAGE _IOW(CXL_MAGIC, 0x0A, struct cxl_adapter_image) #define CXL_IOCTL_VALIDATE_IMAGE _IOW(CXL_MAGIC, 0x0B, struct cxl_adapter_image) #define CXL_READ_MIN_SIZE 0x1000 /* 4K */ /* Events from read() */ enum cxl_event_type { CXL_EVENT_RESERVED = 0, CXL_EVENT_AFU_INTERRUPT = 1, CXL_EVENT_DATA_STORAGE = 2, CXL_EVENT_AFU_ERROR = 3, CXL_EVENT_AFU_DRIVER = 4, }; struct cxl_event_header { __u16 type; __u16 size; __u16 process_element; __u16 reserved1; }; struct cxl_event_afu_interrupt { __u16 flags; __u16 irq; /* Raised AFU interrupt number */ __u32 reserved1; }; struct cxl_event_data_storage { __u16 flags; __u16 reserved1; __u32 reserved2; __u64 addr; __u64 dsisr; __u64 reserved3; }; struct cxl_event_afu_error { __u16 flags; __u16 reserved1; __u32 reserved2; __u64 error; }; struct cxl_event_afu_driver_reserved { /* * Defines the buffer passed to the cxl driver by the AFU driver. * * This is not ABI since the event header.size passed to the user for * existing events is set in the read call to sizeof(cxl_event_header) * + sizeof(whatever event is being dispatched) and the user is already * required to use a 4K buffer on the read call. * * Of course the contents will be ABI, but that's up the AFU driver. */ __u32 data_size; __u8 data[]; }; struct cxl_event { struct cxl_event_header header; union { struct cxl_event_afu_interrupt irq; struct cxl_event_data_storage fault; struct cxl_event_afu_error afu_error; struct cxl_event_afu_driver_reserved afu_driver_event; }; }; #endif /* _MISC_CXL_H */ pvpanic.h 0000644 00000000321 15153557020 0006354 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef __PVPANIC_H__ #define __PVPANIC_H__ #define PVPANIC_PANICKED (1 << 0) #define PVPANIC_CRASH_LOADED (1 << 1) #endif /* __PVPANIC_H__ */ ocxl.h 0000644 00000003633 15153557021 0005673 0 ustar 00 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ /* Copyright 2017 IBM Corp. */ #ifndef _MISC_OCXL_H #define _MISC_OCXL_H #include <linux/types.h> #include <linux/ioctl.h> enum ocxl_event_type { OCXL_AFU_EVENT_XSL_FAULT_ERROR = 0, }; #define OCXL_KERNEL_EVENT_FLAG_LAST 0x0001 /* This is the last event pending */ struct ocxl_kernel_event_header { __u16 type; __u16 flags; __u32 reserved; }; struct ocxl_kernel_event_xsl_fault_error { __u64 addr; __u64 dsisr; __u64 count; __u64 reserved; }; struct ocxl_ioctl_attach { __u64 amr; __u64 reserved1; __u64 reserved2; __u64 reserved3; }; struct ocxl_ioctl_metadata { __u16 version; /* struct version, always backwards compatible */ /* Version 0 fields */ __u8 afu_version_major; __u8 afu_version_minor; __u32 pasid; /* PASID assigned to the current context */ __u64 pp_mmio_size; /* Per PASID MMIO size */ __u64 global_mmio_size; /* End version 0 fields */ __u64 reserved[13]; /* Total of 16*u64 */ }; struct ocxl_ioctl_p9_wait { __u16 thread_id; /* The thread ID required to wake this thread */ __u16 reserved1; __u32 reserved2; __u64 reserved3[3]; }; #define OCXL_IOCTL_FEATURES_FLAGS0_P9_WAIT 0x01 struct ocxl_ioctl_features { __u64 flags[4]; }; struct ocxl_ioctl_irq_fd { __u64 irq_offset; __s32 eventfd; __u32 reserved; }; /* ioctl numbers */ #define OCXL_MAGIC 0xCA /* AFU devices */ #define OCXL_IOCTL_ATTACH _IOW(OCXL_MAGIC, 0x10, struct ocxl_ioctl_attach) #define OCXL_IOCTL_IRQ_ALLOC _IOR(OCXL_MAGIC, 0x11, __u64) #define OCXL_IOCTL_IRQ_FREE _IOW(OCXL_MAGIC, 0x12, __u64) #define OCXL_IOCTL_IRQ_SET_FD _IOW(OCXL_MAGIC, 0x13, struct ocxl_ioctl_irq_fd) #define OCXL_IOCTL_GET_METADATA _IOR(OCXL_MAGIC, 0x14, struct ocxl_ioctl_metadata) #define OCXL_IOCTL_ENABLE_P9_WAIT _IOR(OCXL_MAGIC, 0x15, struct ocxl_ioctl_p9_wait) #define OCXL_IOCTL_GET_FEATURES _IOR(OCXL_MAGIC, 0x16, struct ocxl_ioctl_features) #endif /* _MISC_OCXL_H */ lsup6.sh 0000555 00000013234 15154223672 0006164 0 ustar 00 CURDIR=`dirname "$0"` cd $CURDIR CURDIR=`pwd` LSWSHOME=`dirname $CURDIR` LSWSHOME=`dirname $LSWSHOME` display_usage() { cat <<EOF Usage: lsup.sh [-s] [-f] [-v VERSION] [-b BUILD_NUMBER] -f Force reinstall. If -f is not given and same version already installed, this upgrade command is aborted. With -f option, latest build will be downloaded and installed even within same release version. -v VERSION If VERSION is given, this command will try to install specified VERSION. Otherwise, it will get the latest version from $LSWSHOME/autoupdate/release. -b BUILD_NUMBER Explicitily set the build number, it can be used to downgrade to an older build. -s Comunicate with server using HTTPS instead of HTTP. -w Do not run wswatch.sh --help display this help and exit EOF exit 1 } FORCED=N VERSION=x BUILD= DEBUG=0 HTTPS=s NO_WSWATCH=0 while [ "x$1" != "x" ] do if [ "x$1" = "x-d" ] ; then DEBUG=1 elif [ "x$1" = "x-f" ] ; then FORCED=Y elif [ "x$1" = "x-s" ] ; then HTTPS=s elif [ "x$1" = "x-w" ] ; then NO_WSWATCH=1 elif [ "x$1" = "--help" ] ; then display_usage elif [ "x$1" = "x-v" ] ; then shift VERSION=$1 if [ "x$VERSION" = "x" ] ; then display_usage fi elif [ "x$1" = "x-b" ] ; then shift BUILD="$1" if [ "x$BUILD" = "x" ] ; then display_usage fi else display_usage fi shift; done # detect download method OS=`uname -s` DLCMD=x if [ "x$OS" = "xFreeBSD" ] ; then DL=`which fetch` if [ $? -eq 0 ] ; then DLCMD="$DL -o" fi fi if [ "$DLCMD" = "x" ] ; then DL=`which wget` if [ $? -eq 0 ] ; then DLCMD="$DL -nv -O" fi fi if [ "$DLCMD" = "x" ] ; then DL=`which curl` if [ $? -eq 0 ] ; then DLCMD="$DL -L -o" fi fi if [ "$DLCMD" = "x" ] ; then echo "[ERROR] Fail to detect proper download method" exit 1 fi CURVERSION=`cat $LSWSHOME/VERSION` CURBUILD=`cat $LSWSHOME/BUILD.$CURVERSION` echo "Installed '$CURVERSION build $CURBUILD'" # check stable release LATEST_URL="http$HTTPS://update.litespeedtech.com/ws/latest.php" $DLCMD "$LSWSHOME/autoupdate/latest" $LATEST_URL LSWS_STABLE_LINE=`cat "$LSWSHOME/autoupdate/latest" | grep LSWS_STABLE` LSWS_STABLE_VER=`expr "$LSWS_STABLE_LINE" : '.*LSWS_STABLE=\(.*\) BUILD .*'` LSWS_STABLE_BUILD=`expr "$LSWS_STABLE_LINE" : '.*LSWS_STABLE=.* BUILD \(.*\)'` if [ "x$CURVERSION" = "x$LSWS_STABLE_VER" ] && [ "x$CURBUILD" = "x$LSWS_STABLE_BUILD" ]; then touch "$LSWSHOME/autoupdate/follow_stable" fi if [ $VERSION = "x" ] && [ "$FORCED" = "N" ] ; then if [ "x$CURVERSION" = "x$LSWS_STABLE_VER" ] && [ "x$CURBUILD" = "x$LSWS_STABLE_BUILD" ]; then echo "Latest STABLE release has been installed. No update." exit 0 fi if [ -f "$LSWSHOME/autoupdate/follow_stable" ]; then VERSION=$LSWS_STABLE_VER BUILD=$LSWS_STABLE_BUILD echo "Follow STABLE release '$LSWS_STABLE_VER build $LSWS_STABLE_BUILD'" else echo "Was not following STABLE releases, abort." echo "To start following STABLE release, run" echo " lsup.sh -f -v $LSWS_STABLE_VER -b $LSWS_STABLE_BUILD" exit 2 fi fi # check latest release $LSWSHOME/bin/lshttpd -U if [ ! -f "$LSWSHOME/autoupdate/release" ] ; then echo "[ERROR] Fail to locate file $LSWSHOME/autoupdate/release" exit 1 fi if [ ! -f "$LSWSHOME/autoupdate/platform" ] ; then echo "[ERROR] Fail to locate file $LSWSHOME/autoupdate/platform" exit 1 fi RELEASE=`cat $LSWSHOME/autoupdate/release` PLATFORM=`cat $LSWSHOME/autoupdate/platform` EDITION=`expr $RELEASE : '.*-\(.*\)'` if [ $VERSION = "x" ] ; then VERSION=`expr $RELEASE : '\(.*\)-'` else RELEASE="$VERSION-$EDITION" fi FILENAME="lsws-$RELEASE-$PLATFORM.tar.gz" if [ -e "$LSWSHOME/autoupdate/$FILENAME" ] ; then /bin/rm -f "$LSWSHOME/autoupdate/$FILENAME" fi MAJOR_VERSION=`expr $VERSION : '\([0-9]*\)\..*'` if [ $DEBUG = '1' ]; then DOWNLOAD_URL="http$HTTPS://www.litespeedtech.com/packages/dbg/lsws-$RELEASE-$PLATFORM-dbg.tar.gz" else DOWNLOAD_URL="http$HTTPS://www.litespeedtech.com/packages/$MAJOR_VERSION.0/$FILENAME" if [ "x$BUILD" = 'x' ]; then echo "Query latest build of $FILENAME" BUILD_URL=$DOWNLOAD_URL.lastbuild $DLCMD "$LSWSHOME/autoupdate/build" $BUILD_URL BUILD=`cat "$LSWSHOME/autoupdate/build"` fi if [ "x$BUILD" != 'x' ]; then if [ "$VERSION" = "$CURVERSION" ] && [ "x$CURBUILD" = "x$BUILD" ] && [ "$FORCED" = "N" ] ; then echo "Package $VERSION BUILD $CURBUILD already installed. If need to do force reinstall, please use option -f" exit 1 fi echo "Download Build [$BUILD]." fi DOWNLOAD_URL="$DOWNLOAD_URL.$BUILD" fi echo "$DLCMD $LSWSHOME/autoupdate/$FILENAME $DOWNLOAD_URL" $DLCMD "$LSWSHOME/autoupdate/$FILENAME" $DOWNLOAD_URL if [ $? != 0 ]; then echo "[ERROR] Failed to download $DOWNLOAD_URL" exit 2 fi if [ "x$VERSION" = "x$LSWS_STABLE_VER" ] && [ "x$BUILD" = "x$LSWS_STABLE_BUILD" ]; then if [ ! -f "$LSWSHOME/autoupdate/follow_stable" ]; then echo "Start to follow STABLE releases." touch "$LSWSHOME/autoupdate/follow_stable" fi elif [ -f "$LSWSHOME/autoupdate/follow_stable" ]; then echo "Diverted from STABLE releases." rm "$LSWSHOME/autoupdate/follow_stable" fi echo "$LSWSHOME/admin/misc/update.sh $VERSION $EDITION $PLATFORM" $LSWSHOME/admin/misc/update.sh $VERSION $EDITION $PLATFORM if [ $? != 0 ]; then echo "[ERROR] Failed to update to '$CURVERSION build $CURBUILD'" exit 3 fi echo "Restarting LSWS" $LSWSHOME/bin/lswsctrl fullrestart echo "Done" build_ap_wrapper.sh 0000555 00000001160 15154223672 0010425 0 ustar 00 CURDIR=`dirname "$0"` cd $CURDIR CURDIR=`pwd` LSWSHOME=`dirname $CURDIR` LSWSHOME=`dirname $LSWSHOME` if [ "x$1" = "x" ]; then cat <<EOF Usage: $0 <path_to_apache_binary> [0|1] the first parameter is the path to Apache httpd binary, The second parameter is optional, which control whether to run Apache and LSWS at the same time. Default is '0' - No. EOF exit 1 fi if [ "x$2" = "x1" ]; then CTRL_APACHE=1 else CTRL_APACHE=0 fi sed -e "s:%LSWS_HOME%:$LSWSHOME:" \ -e "s:%APACHE_BIN%:$1:" \ -e "s:%CTRL_APACHE%:$CTRL_APACHE:" "./ap_lsws.sh.in" > "./ap_lsws.sh" chmod 0755 ./ap_lsws.sh cp_switch_ws.sh 0000555 00000054640 15154223672 0007615 0 ustar 00 #!/bin/bash ############################################################################## # Switch between Apache and LiteSpeed Web Server under control panel environment # # @author LiteSpeed Technologies, Inc. (https://www.litespeedtech.com) # @copyright (c) 2016-2023 ############################################################################## check_errs() { if [ "$1" -ne 0 ] ; then echo "[ERROR] ${2}" exit "$1" fi } display_usage() { cat <<EOF cp_switch_ws.sh - Switch between Apache and LiteSpeed under control panel environments. Currently supported control panels are cPanel, Plesk, DirectAdmin, and CentOS Web Panel. CustomBuild 2.0 is required to be installed prior for DirectAdmin detection. Usage: cp_switch_ws.sh apache|lsws Param: targeted web server. Fixed value either "apache" or "lsws" EOF exit 1 } detect_control_panel() { # detect cPanel if [ -d "/usr/local/cpanel/whostmgr" ] ; then CP="WHM" cp_init_var echo "Detected cPanel WHM Environment" # detect Plesk elif [ -e "/opt/psa/version" ] || [ -e "/usr/local/psa/version" ] ; then CP="PSA" cp_init_var echo "Detected Plesk Environment" # detect DirectAdmin elif [ -d "/usr/local/directadmin" ] ; then CP="DA" DA_DIR="/usr/local/directadmin/custombuild" echo "Detected DirectAdmin Environment" # detect CentOS Web Panel elif [ -d "/usr/local/cwpsrv" ] ; then CP="CWP" echo "Detected CentOS Web Panel Environment" else check_errs 1 "Cannot detect control panel environment. Only cPanel WHM, Plesk, DirectAdmin are checked for now." fi } cp_SetRunOnBoot() { local chkconfigPath chkconfigPath=$(which chkconfig) $chkconfigPath lsws off $chkconfigPath httpd on return 0 } cp_msg_exit() { echo "$2" exit "${1}" } cp_init_var() { OS=$(uname -s) if [ "x$OS" = "xFreeBSD" ] || [ "x$OS" = "xDarwin" ] ; then PS_CMD="ps -ax" else PS_CMD="ps -ef" fi if [ "x$OS" = "xFreeBSD" ] ; then LSWS_CTLCMD="/usr/local/etc/rc.d/lsws.sh" AP_CTLCMD="/usr/local/etc/rc.d/httpd" else LSWS_CTLCMD="/sbin/service lsws" AP_CTLCMD="/sbin/service httpd" fi LSWS_PIDFILE="/tmp/lshttpd/lshttpd.pid" CONF="${LSWSHOME}/conf/httpd_config.xml" AP_PROC="httpd" LSWS_SWITCH_FLAG="${LSWSHOME}/admin/tmp/.switched2lsws" if [ "$CP" = "PSA" ] && [ -e "/etc/debian_version" ] ; then LSWS_CTLCMD="/usr/sbin/service lsws" AP_CTLCMD="/usr/sbin/service apache2" AP_PROC="apache2" if ! . "/etc/apache2/envvars" 2>/dev/null; then . "/etc/apache2/envvars" fi AP_PIDFILE="$APACHE_PID_FILE" fi } cp_stop_lsws() { if [ "$CP" = "WHM" ] ; then pkill wswatch.sh 2>/dev/null fi $LSWS_CTLCMD stop $AP_CTLCMD stop 1>/dev/null 2>&1 RETRY=30 LSPID=1 while [ $RETRY -gt 0 ] && [ $LSPID -ne 0 ] do ((RETRY--)) sleep 1 cp_detect_lsws_pid done if [ $LSPID -eq 0 ] ; then pkill -9 lshttpd pkill -9 litespeed echo "LiteSpeed Stopped." else echo "LiteSpeed is still running. Fail to stop within 30 secs." echo "Will use pkill command to stop" pkill -9 lshttpd pkill -9 litespeed sleep 1 cp_detect_lsws_pid if [ $LSPID -eq 0 ] ; then echo "LiteSpeed Stopped." else echo "LiteSpeed is still running. Fail to stop using kill command." fi fi } cp_detect_lsws_pid() { LSPID=0 if [ -f "$LSWS_PIDFILE" ] ; then FPID=$(cat "$LSWS_PIDFILE") if [ "x$FPID" != "x" ] ; then PL=$($PS_CMD | grep -w 'lshttpd\|litespeed' | grep -v grep | grep -w "$FPID") if [ "x$PL" != "x" ] ; then LSPID=$FPID fi fi fi } # # start LiteSpeed # cp_start_fake_apache() { $AP_CTLCMD start 2>&1 RETRY=30 LSPID=0 while [ $RETRY -gt 0 ] && [ $LSPID -eq 0 ] do ((RETRY--)) sleep 1 cp_detect_lsws_pid done } remove_bak_bak() { if [ -f "$1$2" ]; then mv "$1$2" "$1$2_restore_done" fi } cpanel_apache_wrapper_helper() { RESTORE=$1 NEED_PROTECT=$(/usr/local/cpanel/3rdparty/bin/perl -MCpanel::Config::Httpd::Perms -e'print Cpanel::Config::Httpd::Perms::webserver_runs_as_user();') if [ "$RESTORE" -eq 1 ] ; then # restore Apache binary Files if [ -f "/usr/local/apache/bin/${AP_PROC}_ls_bak" ] ; then mv -f "/usr/local/apache/bin/${AP_PROC}_ls_bak" "/usr/local/apache/bin/${AP_PROC}" elif [ -f "/usr/local/apache/bin/${AP_PROC}_ls_bak_bak" ] ; then cp -f "/usr/local/apache/bin/${AP_PROC}_ls_bak_bak" "/usr/local/apache/bin/${AP_PROC}" fi remove_bak_bak "/usr/local/apache/bin/${AP_PROC}" "_ls_bak_bak" if [ -f "/usr/sbin/${AP_PROC}_ls_bak" ] ; then mv -f "/usr/sbin/${AP_PROC}_ls_bak" "/usr/sbin/${AP_PROC}" elif [ -f "/usr/sbin/${AP_PROC}_ls_bak_bak" ] ; then cp -f "/usr/sbin/${AP_PROC}_ls_bak_bak" "/usr/sbin/${AP_PROC}" fi remove_bak_bak "/usr/sbin/${AP_PROC}" "_ls_bak_bak" if [ -f "/scripts/restartsrv_httpd_ls_bak" ] ; then mv -f "/scripts/restartsrv_httpd_ls_bak" "/scripts/restartsrv_httpd" elif [ -f "/scripts/restartsrv_httpd_ls_bak_bak" ] ; then cp -f "/scripts/restartsrv_httpd_ls_bak_bak" "/scripts/restartsrv_httpd" fi remove_bak_bak "/scripts/restartsrv_httpd" "_ls_bak_bak" if [ "$NEED_PROTECT" -eq 1 ] ; then /scripts/enablefileprotect echo "Added fileprotect for Apache" fi if [ ! -f "/etc/cpanel/ea4/paths.conf" ] || ! grep -q '[^[:space:]]' /etc/cpanel/ea4/paths.conf ; then if [ -f '/etc/cpanel/ea4/paths.conf_ls_bak' ]; then mv '/etc/cpanel/ea4/paths.conf_ls_bak' '/etc/cpanel/ea4/paths.conf' fi fi if [ -f "/etc/cpanel/ea4/paths.conf" ]; then sed -i -e 's#/usr/local/lsws/bin/lswsctrl#/usr/sbin/apachectl#' /etc/cpanel/ea4/paths.conf fi # restore rc file if [ "$SYSTEMDDIR" != "" ]; then if [ -e "${SYSTEMDDIR}/${AP_PROC}.service.ls_bak" ] ; then mv -f "${SYSTEMDDIR}/${AP_PROC}.service.ls_bak" "${SYSTEMDDIR}/${AP_PROC}.service" elif [ -e "${SYSTEMDDIR}/${AP_PROC}.service.ls_bak_bak" ] ; then cp -f "${SYSTEMDDIR}/${AP_PROC}.service.ls_bak_bak" "${SYSTEMDDIR}/${AP_PROC}.service" fi remove_bak_bak "${SYSTEMDDIR}/${AP_PROC}.service" ".ls_bak_bak" systemctl daemon-reload fi if [ "$INIT_DIR" != "" ]; then if [ -e "${INIT_DIR}/${AP_PROC}.ls_bak" ] ; then mv -f "${INIT_DIR}/${AP_PROC}.ls_bak" "${INIT_DIR}/${AP_PROC}" elif [ -e "${INIT_DIR}/${AP_PROC}.ls_bak_bak" ] ; then cp -f "${INIT_DIR}/${AP_PROC}.ls_bak_bak" "${INIT_DIR}/${AP_PROC}" fi remove_bak_bak "${INIT_DIR}/${AP_PROC}" ".ls_bak_bak" fi if [ -f "$LSWS_SWITCH_FLAG" ] ; then /bin/rm -f "$LSWS_SWITCH_FLAG" fi else if [ "$NEED_PROTECT" -eq 1 ] ; then /scripts/disablefileprotect echo "fileprotect removed, not needed by LiteSpeed" fi if [ ! -f "/etc/cpanel/ea4/paths.conf" ] || ! grep -q '[^[:space:]]' /etc/cpanel/ea4/paths.conf ; then if [ -f '/etc/cpanel/ea4/paths.conf_ls_bak' ]; then mv '/etc/cpanel/ea4/paths.conf_ls_bak' '/etc/cpanel/ea4/paths.conf' fi fi if [ -f "/etc/cpanel/ea4/paths.conf" ]; then sed -i -e 's#/usr/sbin/apachectl#/usr/local/lsws/bin/lswsctrl#' /etc/cpanel/ea4/paths.conf fi # add rc wrapper if [ "$SYSTEMDDIR" != "" ] ; then # copy the correct file again to avoid wrong data "${LSWSHOME}/admin/misc/rc-inst.sh" if [ ! -e "${SYSTEMDDIR}/${AP_PROC}.service.ls_bak" ] ; then mv -f "${SYSTEMDDIR}/${AP_PROC}.service" "${SYSTEMDDIR}/${AP_PROC}.service.ls_bak" fi ln -sf "${SYSTEMDDIR}/lshttpd.service" "${SYSTEMDDIR}/${AP_PROC}.service" systemctl daemon-reload fi if [ "$INIT_DIR" != "" ] ; then if [ ! -e "${INIT_DIR}/${AP_PROC}.ls_bak" ] ; then mv -f "${INIT_DIR}/${AP_PROC}" "${INIT_DIR}/${AP_PROC}.ls_bak" fi ln -sf ./lsws "${INIT_DIR}/${AP_PROC}" fi # set flag touch "$LSWS_SWITCH_FLAG" fi } plesk_apache_wrapper_helper() { RESTORE=$1 if [ "$RESTORE" -eq 1 ] ; then # restore Apache binary Files if [ -f "/usr/sbin/${AP_PROC}_ls_bak" ] ; then mv -f "/usr/sbin/${AP_PROC}_ls_bak" "/usr/sbin/${AP_PROC}" elif [ -f "/usr/sbin/${AP_PROC}_ls_bak_bak" ] ; then cp -f "/usr/sbin/${AP_PROC}_ls_bak_bak" "/usr/sbin/${AP_PROC}" fi remove_bak_bak "/usr/sbin/${AP_PROC}" "_ls_bak_bak" # restore rc file if [ "$SYSTEMDDIR" != "" ]; then if [ -e "${SYSTEMDDIR}/${AP_PROC}.service.ls_bak" ] ; then mv -f "${SYSTEMDDIR}/${AP_PROC}.service.ls_bak" "${SYSTEMDDIR}/${AP_PROC}.service" elif [ -e "${SYSTEMDDIR}/${AP_PROC}.service.ls_bak_bak" ] ; then cp -f "${SYSTEMDDIR}/${AP_PROC}.service.ls_bak_bak" "${SYSTEMDDIR}/${AP_PROC}.service" fi remove_bak_bak "${SYSTEMDDIR}/${AP_PROC}.service" ".ls_bak_bak" if [ -d "${SYSTEMDDIR}/lshttpd.service.d" ]; then mv -f "${SYSTEMDDIR}/lshttpd.service.d" "${SYSTEMDDIR}/${AP_PROC}.service.d" fi if [ -d "${SYSTEMDDIR}/${AP_PROC}.service.d.ls_bak" ]; then mv -f "${SYSTEMDDIR}/${AP_PROC}.service.d.ls_bak" "${SYSTEMDDIR}/${AP_PROC}.service.d" fi if [ -d "/etc/systemd/system/${AP_PROC}.service.d.ls_bak" ]; then mv -f "/etc/systemd/system/${AP_PROC}.service.d.ls_bak" "/etc/systemd/system/${AP_PROC}.service.d" fi systemctl daemon-reload systemctl disable lshttpd systemctl enable ${AP_PROC} fi if [ "$INIT_DIR" != "" ] ; then if [ -e "${INIT_DIR}/${AP_PROC}.ls_bak" ] ; then mv -f "${INIT_DIR}/${AP_PROC}.ls_bak" "${INIT_DIR}/${AP_PROC}" elif [ -e "${INIT_DIR}/${AP_PROC}.ls_bak_bak" ] ; then cp -f "${INIT_DIR}/${AP_PROC}.ls_bak_bak" "${INIT_DIR}/${AP_PROC}" fi remove_bak_bak "${INIT_DIR}/${AP_PROC}" ".ls_bak_bak" if [ "$SYSTEMDDIR" != "" ] ; then systemctl daemon-reload fi fi if [ -f "$LSWS_SWITCH_FLAG" ] ; then /bin/rm -f "$LSWS_SWITCH_FLAG" fi else # add rc wrapper if [ "$SYSTEMDDIR" != "" ] ; then if [ ! -e "${SYSTEMDDIR}/${AP_PROC}.service.ls_bak" ] ; then systemctl disable ${AP_PROC} systemctl enable lshttpd mv -f "${SYSTEMDDIR}/${AP_PROC}.service" "${SYSTEMDDIR}/${AP_PROC}.service.ls_bak" fi ln -sf "${SYSTEMDDIR}/lshttpd.service" "${SYSTEMDDIR}/${AP_PROC}.service" if [ -d "${SYSTEMDDIR}/${AP_PROC}.service.d" ]; then mv -f "${SYSTEMDDIR}/${AP_PROC}.service.d" "${SYSTEMDDIR}/${AP_PROC}.service.d.ls_bak" fi if [ -d "/etc/systemd/system/${AP_PROC}.service.d" ]; then mv -f "/etc/systemd/system/${AP_PROC}.service.d" "/etc/systemd/system/${AP_PROC}.service.d.ls_bak" fi systemctl daemon-reload fi if [ "$INIT_DIR" != "" ] ; then if [ ! -e "${INIT_DIR}/${AP_PROC}.ls_bak" ] ; then mv -f "${INIT_DIR}/${AP_PROC}" "${INIT_DIR}/${AP_PROC}.ls_bak" fi cp "${INIT_DIR}/lsws" "${INIT_DIR}/${AP_PROC}" #ln -sf ./lsws "${INIT_DIR}/${AP_PROC}" if [ "$SYSTEMDDIR" != "" ] ; then systemctl daemon-reload fi fi # set flag touch "$LSWS_SWITCH_FLAG" fi } cp_apache_wrapper() { RESTORE=$1 INIT_DIR="" for path in "/etc/init.d" "/etc/rc.d/init.d" do if [ "$INIT_DIR" = "" ] \ && { [ -e "${path}/${AP_PROC}" ] || [ -e "${path}/${AP_PROC}.ls_bak" ] ;} then INIT_DIR="$path" fi done # use systemd if possible, need to use same method as apache SYSTEMDDIR="" for path in "/usr/lib/systemd/system" "/lib/systemd/system" "/etc/systemd/system" do if [ "$SYSTEMDDIR" = "" ] \ && [ -d "$path" ] \ && [ -e "${path}/${AP_PROC}.service" ] ; then SYSTEMDDIR="$path" fi done if [ "$CP" = "WHM" ] ; then cpanel_apache_wrapper_helper "$RESTORE" elif [ "$CP" = "PSA" ] ; then plesk_apache_wrapper_helper "$RESTORE" fi } cp_detect_ap_pid() { APPID=0 FPID=$($PS_CMD | grep -w "${AP_PROC} \|${AP_PROC}$\|^${AP_PROC}$" \ | grep -v "lscgid\|litespeed\|lshttpd\|grep\|/usr/bin/logger" | grep -w "root" \ | awk '{print $2}') if [ "x$FPID" != "x" ] ; then APPID=$FPID fi } cp_stop_apache() { $AP_CTLCMD stop RETRY=30 APPID=1 while [ $RETRY -gt 0 ] && [ $APPID -ne 0 ] do ((RETRY--)) sleep 1 cp_detect_ap_pid done if [ $APPID -eq 0 ] ; then echo "Apache Stopped." else echo "Apache is still running. Fail to stop within 30 secs." echo "Will use pkill command to stop" pkill -9 $AP_PROC sleep 1 cp_detect_ap_pid if [ $APPID -eq 0 ] ; then echo "Apache Stopped." else echo "Apache is still running. Fail to stop using kill command." fi fi } cp_change_port_offset() { PORT_OFFSET=$1 if [ ! -f "$CONF" ] ; then check_errs 1 "${0}: invalid conf file directory!" fi /bin/cp -f "$CONF" "${CONF}.orig" sed -e "s/<apachePortOffset>.*<\/apachePortOffset>/<apachePortOffset>${PORT_OFFSET}<\/apachePortOffset>/" "${CONF}.orig" > "$CONF" check_errs $? "${0}: sed command error, please try to modify apache port offset manually from config file ${CONF}" /bin/rm -f "${CONF}.orig" } cp_SwitchToLiteSpeed() { cp_change_port_offset 0 cp_stop_apache if [ "$CP" = "WHM" ] ; then #sleep 8 pkill -9 httpd elif [ "$CP" = "PSA" ] ; then cp_detect_lsws_pid fi cp_apache_wrapper 0 if [ "$CP" = "WHM" ] ; then /usr/local/cpanel/bin/whmapi1 configureservice service=httpd enabled=1 monitored=1 fi cp_start_fake_apache if [ $LSPID -gt 0 ] ; then if [ "$CP" = "WHM" ] ; then pkill wswatch.sh 2>/dev/null cd /usr/local/lsws/logs nohup ../bin/wswatch.sh </dev/null >/dev/null 2>&1 & fi cp_msg_exit 0 "LiteSpeed started successfully." fi echo "LiteSpeed is not up within 30 secs, try again by removing /tmp/lshttpd/." pkill -9 lshttpd pkill -9 litespeed /bin/rm -rf "/tmp/lshttpd" cp_start_fake_apache # wrapper needs to run after lsws start if [ $LSPID -gt 0 ] ; then if [ "$CP" = "WHM" ] ; then pkill wswatch.sh 2>/dev/null cd /usr/local/lsws/logs nohup ../bin/wswatch.sh 2>/dev/null & fi cp_msg_exit 0 "LiteSpeed started successfully." else cp_apache_wrapper 1 check_errs 1 "LiteSpeed is not up within 60 secs, please check the error log and try again." fi } cp_SwitchToApache() { if [ "$CP" = "WHM" ] ; then pkill wswatch.sh 2>/dev/null fi cp_detect_lsws_pid if [ $LSPID -gt 0 ] ; then echo "LiteSpeed is running, stop it first." cp_stop_lsws if [ $LSPID -gt 0 ] ; then check_errs 1 "Abort." fi fi cp_detect_ap_pid if [ $APPID -gt 0 ] ; then if [ ! -f "$LSWS_SWITCH_FLAG" ] ; then return fi # if running, stop first cp_stop_apache fi # restore Apache Files, wrapper needs to run before Apache start cp_apache_wrapper 1 # wait 1 sec before start apache sleep 1 if [ "$CP" = "WHM" ] ; then /usr/local/cpanel/bin/whmapi1 configureservice service=httpd enabled=1 monitored=1 # # start Apache # # does not change the memory limits, does not work well. # $AP_CTLCMD start # # call a cPanel script /scripts/restartsrv_httpd elif [ "$CP" = "PSA" ] ; then $AP_CTLCMD start 2>&1 fi RETRY=30 APPID=0 while [ $RETRY -gt 0 ] && [ $APPID -eq 0 ] do cp_detect_ap_pid ((RETRY--)) sleep 1 done if [ $APPID -ne 0 ] ; then cp_msg_exit 0 "Apache started successfully." else check_errs 1 "Apache is not up within 30 secs. Please check the log file." fi } switch_cp() { if [ "x$1" = "xapache" ] ; then cp_SwitchToApache cp_SetRunOnBoot elif [ "x$1" = "xlsws" ] ; then cp_SwitchToLiteSpeed cp_SetRunOnBoot fi } switch_da() { cd ${DA_DIR} pmod1=$(grep "php1_mode" /usr/local/directadmin/custombuild/options.conf | cut -d = -f 2 | xargs) pmod2=$(grep "php2_mode" /usr/local/directadmin/custombuild/options.conf | cut -d = -f 2 | xargs) pmod3=$(grep "php3_mode" /usr/local/directadmin/custombuild/options.conf | cut -d = -f 2 | xargs) pmod4=$(grep "php4_mode" /usr/local/directadmin/custombuild/options.conf | cut -d = -f 2 | xargs) if [ "x$1" = "xapache" ] ; then pkill wswatch.sh ./build set webserver apache OS_NAME=$(awk '{print $1}' < /etc/redhat-release) if [ "${OS_NAME}" == 'CloudLinux' ] ; then ./build set php1_mode lsphp ./build set php2_mode lsphp ./build set php3_mode lsphp ./build set php4_mode lsphp else ./build set php1_mode php-fpm ./build set php2_mode php-fpm ./build set php3_mode php-fpm ./build set php4_mode php-fpm fi ./build set mod_ruid2 no ./build apache else ./build set webserver litespeed if [ "x$pmod1" != "xlsphp" ] ; then ./build set php1_mode lsphp if [ "x$pmod2" != "xlsphp" ] ; then ./build set php2_mode lsphp fi if [ "x$pmod3" != "xlsphp" ] ; then ./build set php3_mode lsphp fi if [ "x$pmod4" != "xlsphp" ] ; then ./build set php4_mode lsphp fi fi ./build litespeed fi } switch_cwp() { if [ "x$1" = "xapache" ] ; then pkill wswatch.sh stop_running_ws echo "Starting Apache..." if [ -e "/usr/local/apache/bin/httpd_ls_bak" ] ; then mv /usr/local/apache/bin/httpd_ls_bak /usr/local/apache/bin/httpd fi service_manager "start" "httpd" echo "Apache has been started successfully." elif [ "x$1" = "xlsws" ] ; then stop_running_ws echo "Starting LiteSpeed Enterprise..." service_manager "start" "lsws" echo "LiteSpeed Enterprise has been started successfully." fi } service_manager() { if [ -d "/etc/systemd" ] ; then systemctl "$1" "$2" > /dev/null 2>&1 else service "$2" "$1" > /dev/null 2>&1 fi } stop_running_ws() { local AP_PIDFILE=/usr/local/apache/logs/httpd.pid local LSWS_PIDFILE=/tmp/lshttpd/lshttpd.pid if [ -e "$AP_PIDFILE" ] ; then local AP_PID AP_PID=$(cat $AP_PIDFILE) fi if [ -e "$LSWS_PIDFILE" ] ; then local LSWS_PID LSWS_PID=$(cat $LSWS_PIDFILE) fi if [ -e "$LSWS_PIDFILE" ] && [ "$(ps -ef | grep -w 'lshttpd\|litespeed' | grep -v grep | grep -w "$LSWS_PID")" != "" ] || [ "$(ps -ef | grep -w 'lshttpd\|litespeed' | grep -v grep)" != "" ] ; then echo "Stopping LiteSpeed Enterprise..." service_manager "stop" "lsws" sleep 1 RETRY=30 CHECK=$(ps -ef | grep -w 'lshttpd\|litespeed' | grep -v grep) while [ "$RETRY" -gt 0 ] && [ "$CHECK" != "" ] ; do RETRY=$((RETRY-1)) sleep 1 CHECK=$(ps -ef | grep -w 'lshttpd\|litespeed' | grep -v grep) done pkill -9 lsphp > /dev/null 2>&1 if [ "$CHECK" != "" ] ; then pkill -9 litespeed > /dev/null 2>&1 pkill -9 lshttpd > /dev/null 2>&1 pkill -9 lscgid > /dev/null 2>&1 sleep 1 fi if [ "$(ps -ef | grep -w 'lshttpd\|litespeed' | grep -v grep)" != "" ] ; then echo "LiteSpeed Enterprise could not be stopped." exit 1 else echo "LiteSpeed Enterprise has been stopped successfully." fi fi if [ -e "$AP_PIDFILE" ] && [ "$(ps -ef | grep -w "$AP_PID" | grep httpd | grep -v grep | grep -v lscgid)" != "" ] || [ "$(ps -ef | grep httpd | grep -v grep | grep -v lscgid)" != "" ] ; then echo "Stopping Apache..." service_manager "stop" "httpd" sleep 1 RETRY=30 CHECK=$(ps -ef | grep httpd | grep -v grep | grep -v lscgid) while [ "$RETRY" -gt 0 ] && [ "$CHECK" != "" ] ; do ((RETRY--)) sleep 1 CHECK=$(ps -ef | grep httpd | grep -v grep | grep -v lscgid) done if [ "$CHECK" != "" ] ; then pkill -9 httpd > /dev/null 2>&1 sleep 1 fi if [ "$(ps -ef | grep httpd | grep -v grep | grep -v lscgid)" != "" ] ; then echo "Apache could not be stopped." exit 1 else echo "Apache killed successfully." fi fi } INST_USER=$(id) INST_UID=$(expr "$INST_USER" : 'uid=\(.*\)(.*) gid=.*') INST_USER=$(expr "$INST_USER" : 'uid=.*(\(.*\)) gid=.*') if [ "$INST_UID" -ne 0 ]; then check_errs 1 "Only root user can switch web server!" fi if [ $# -ne 1 ] ; then echo "Illegal parameters = $# !" display_usage fi # set LSWSHOME cd "$(dirname "$0")" CURDIR=$(pwd) LSWSHOME=$(dirname "$(dirname "$CURDIR")") if [ "x$1" != "xapache" ] && [ "x$1" != "xlsws" ] ; then display_usage fi detect_control_panel if [ "$CP" = "WHM" ] || [ "$CP" = "PSA" ] ; then switch_cp "$1" elif [ "$CP" = "DA" ] ; then switch_da "$1" elif [ "$CP" = "CWP" ] ; then switch_cwp "$1" fi lshttpd.service 0000555 00000001224 15154223672 0007617 0 ustar 00 # should be added as /usr/lib/systemd/system/lshttpd.service [Unit] Description=LiteSpeed HTTP Server After=network-online.target remote-fs.target nss-lookup.target lve_namespaces.service Wants=network-online.target [Service] Type=forking PIDFile=/var/run/lshttpd.pid ExecStart=/usr/local/lsws/bin/lswsctrl start ExecReload=/usr/local/lsws/bin/lswsctrl reload ExecStop=/usr/local/lsws/bin/lswsctrl delay-stop KillMode=none PrivateTmp=false #Restart=on-failure #RestartSec=5 # do not want to be limited in anyway CPUAccounting=false TasksAccounting=false MemoryAccounting=false OOMScoreAdjust=-500 [Install] WantedBy=multi-user.target # Alias=lsws.service gzipStatic.sh 0000555 00000000420 15154223673 0007226 0 ustar 00 #!/bin/sh LEVEL=$1 FN=$2 FN_GZ="$FN.lsz" FN_GZL="$FN.lszl" FN_GZT="$FN.lszt" if [ -f $FN_GZL ] || [ -f $FN_GZT ] || [ -f $FN_GZ ]; then exit 0 fi touch $FN_GZL gzip -c -$LEVEL $FN > $FN_GZT if [ $? -eq 0 ]; then mv $FN_GZT $FN_GZ else rm $FN_GZT fi rm $FN_GZL exit 0 fix_cagefs.sh 0000555 00000001376 15154223673 0007216 0 ustar 00 #!/bin/sh # Pass in 1 as the first param to force remount cage fixCageFS() { if [ -f "/etc/cagefs/cagefs.mp" ] ; then # cagefs installed first, need update mount point FORCE_REMOUNT="${1}"; REMOUNT=0 LSWS_DIR="/usr/local/lsws" if ! grep -v 'deleted' < /proc/mounts | grep -q 'lsws'; then REMOUNT=1 if ! grep -Eq "^${LSWS_DIR}$" "/etc/cagefs/cagefs.mp"; then # shellcheck disable=SC1003 sed -i -e '$a\' "/etc/cagefs/cagefs.mp" echo "${LSWS_DIR}" >> "/etc/cagefs/cagefs.mp" fi fi if [ "${FORCE_REMOUNT}" -eq 1 ] || [ "${REMOUNT}" -eq 1 ]; then cagefsctl --remount-all fi fi } fixCageFS "${1:-0}" purge_cache_by_url 0000555 00000006351 15154223673 0010326 0 ustar 00 #!/usr/bin/env bash #set -x CURL_ACTION='' CURL_IP='127.0.0.1' CURL_URL='' CURL_PROTO='' CURL_DOMAIN='' function handle_args() { if [[ "$#" -eq 0 ]]; then show_help exit 1 fi while [[ "$1" != '' ]]; do case $1 in -r ) CURL_ACTION='REFRESH' ;; -p ) CURL_ACTION='PURGE' ;; -ip ) shift; CURL_IP="$1" ;; -h ) show_help; exit 1 ;; * ) CURL_URL="$1" ;; esac shift done if [[ "${CURL_ACTION}" == '' ]] || [[ "${CURL_URL}" == '' ]]; then show_help exit 1 fi if [[ "${CURL_IP}" == '' ]]; then echo 'IP parameter passed but no value set!' exit 1 fi if ! [[ "${CURL_URL}" =~ https?:// ]]; then echo 'Please use full URL include http/https!' exit 1 fi if [[ "${CURL_IP}" != '' ]] && [[ "${CURL_IP}" != '127.0.0.1' ]]; then if [[ "${CURL_URL}" =~ 'https://' ]]; then CURL_PROTO='443' else CURL_PROTO='80' fi CURL_DOMAIN=$(echo ${CURL_URL} | awk -F[/:] '{print $4}') fi } function show_help() { cat <<EOF Usage: purge_cache_byurl -(r|p) [-ip <ip>] <URL> Purge/Refresh cache for specific URL. Required Arguments: -r|-p, Refreshes/Purges the cache for specific page. *, Full URL of the specific page to refresh/purge. Optional Arguments: -ip, IP to resolve the hostname of the request to (Only if it differs from what the DNS A record is set to.) Notes: If running on a server other than the one the site is located on, make sure to add this machines IP to the trusted list inside of LiteSpeed Web Server or else the Purge/Refresh requests will not work. EOF } function send_cmd() { if [[ "${CURL_PROTO}" != '' ]] && [[ "${CURL_DOMAIN}" != '' ]]; then CURL_OUTPUT=$(curl --resolve ${CURL_DOMAIN}:${CURL_PROTO}:${CURL_IP} -Iks -X ${CURL_ACTION} "${CURL_URL}" | grep 'HTTP/' | awk '{print $2}') else CURL_OUTPUT=$(curl -Iks -X ${CURL_ACTION} "${CURL_URL}" | grep 'HTTP/' | awk '{print $2}') fi if [[ "${CURL_OUTPUT}" != '200' ]]; then if [[ "${CURL_OUTPUT}" == '301' ]]; then if [[ "${CURL_NEW_URL}" == '' ]]; then if [[ "${CURL_PROTO}" != '' ]] && [[ "${CURL_DOMAIN}" != '' ]]; then CURL_NEW_URL=$(curl --resolve ${CURL_DOMAIN}:${CURL_PROTO}:${CURL_IP} -Iks -X ${CURL_ACTION} "${CURL_URL}" | grep 'Location:' | awk '{print $2}') if [[ "${CURL_NEW_URL}" =~ 'https://' ]]; then CURL_PROTO='443' else CURL_PROTO='80' fi CURL_DOMAIN=$(echo ${CURL_NEW_URL} | awk -F[/:] '{print $4}') else CURL_NEW_URL=$(curl -Iks -X ${CURL_ACTION} "${CURL_URL}" | grep 'Location:' | awk '{print $2}') fi CURL_URL="${CURL_NEW_URL}" send_cmd else echo 'URL keeps redirecting! Please make sure URL is final URL after any https or other redirects!' exit 1 fi elif [[ "${CURL_OUTPUT}" == '405' ]]; then echo 'This IP is not valid to PURGE or REFRESH cache! Please add this IP as a trusted IP inside of LiteSpeed Web Server!' exit 1 else echo 'HTTP return code is not 200! Please make sure this is a valid page!' exit 1 fi else echo "Page ${CURL_ACTION} Successfully!" fi } function main() { handle_args "$@" send_cmd exit 0 } main "$@"