parent
4e0f0eebf7
commit
2902601157
|
@ -102,6 +102,7 @@ if(isset($L_ALTERNC_LOGS_ARCHIVE))
|
||||||
define('ALTERNC_LOGS', "$L_ALTERNC_LOGS");
|
define('ALTERNC_LOGS', "$L_ALTERNC_LOGS");
|
||||||
define('ALTERNC_PANEL', "/usr/share/alternc/panel");
|
define('ALTERNC_PANEL', "/usr/share/alternc/panel");
|
||||||
define('ALTERNC_LOCALES', ALTERNC_PANEL."/locales");
|
define('ALTERNC_LOCALES', ALTERNC_PANEL."/locales");
|
||||||
|
define('ALTERNC_LOCK_JOBS', '/var/run/alternc/jobs-lock');
|
||||||
|
|
||||||
/* PHPLIB inclusions : */
|
/* PHPLIB inclusions : */
|
||||||
$root=ALTERNC_PANEL."/";
|
$root=ALTERNC_PANEL."/";
|
||||||
|
|
|
@ -134,6 +134,14 @@ class m_admin {
|
||||||
return $obj;
|
return $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stop_if_jobs_locked() {
|
||||||
|
if ( file_exists(ALTERNC_LOCK_JOBS)) {
|
||||||
|
echo "There is a file ".ALTERNC_LOCK_JOBS."\n";
|
||||||
|
echo "So no jobs are allowed\n";
|
||||||
|
echo "Did you launch alternc.install ?\n";
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
/** Returns the known information about a hosted account
|
/** Returns the known information about a hosted account
|
||||||
|
|
|
@ -45,6 +45,9 @@ done
|
||||||
|
|
||||||
. /usr/lib/alternc/functions.sh
|
. /usr/lib/alternc/functions.sh
|
||||||
|
|
||||||
|
# Lock the jobs !
|
||||||
|
lock_jobs
|
||||||
|
|
||||||
# hook
|
# hook
|
||||||
run-parts --arg=startup /usr/lib/alternc/install.d
|
run-parts --arg=startup /usr/lib/alternc/install.d
|
||||||
|
|
||||||
|
@ -573,3 +576,6 @@ echo "Compile PO files"
|
||||||
|
|
||||||
# hook
|
# hook
|
||||||
run-parts --arg=end /usr/lib/alternc/install.d
|
run-parts --arg=end /usr/lib/alternc/install.d
|
||||||
|
|
||||||
|
# Unlock jobs !
|
||||||
|
unlock_jobs
|
||||||
|
|
|
@ -14,6 +14,8 @@ for CONFIG_FILE in \
|
||||||
. "$CONFIG_FILE"
|
. "$CONFIG_FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
stop_if_jobs_locked
|
||||||
|
|
||||||
# ALTERNC_LOGS is from local.sh
|
# ALTERNC_LOGS is from local.sh
|
||||||
|
|
||||||
#Compress logs older than XX days
|
#Compress logs older than XX days
|
||||||
|
|
|
@ -13,6 +13,8 @@ for CONFIG_FILE in \
|
||||||
. "$CONFIG_FILE"
|
. "$CONFIG_FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
stop_if_jobs_locked
|
||||||
|
|
||||||
max_process=2
|
max_process=2
|
||||||
|
|
||||||
tasks () {
|
tasks () {
|
||||||
|
|
|
@ -14,6 +14,7 @@ for CONFIG_FILE in \
|
||||||
. "$CONFIG_FILE"
|
. "$CONFIG_FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
# ALTERNC_LOGS is from local.sh
|
stop_if_jobs_locked
|
||||||
|
|
||||||
|
# ALTERNC_LOGS is from local.sh
|
||||||
nice 10 -n find "$ALTERNC_LOGS" -mtime +$DAYS -delete
|
nice 10 -n find "$ALTERNC_LOGS" -mtime +$DAYS -delete
|
||||||
|
|
|
@ -53,6 +53,8 @@ function mail_it(){
|
||||||
|
|
||||||
require_once("/usr/share/alternc/panel/class/config_nochk.php");
|
require_once("/usr/share/alternc/panel/class/config_nochk.php");
|
||||||
|
|
||||||
|
$admin->stop_if_jobs_locked();
|
||||||
|
|
||||||
$LOCK_FILE='/var/run/alternc/do_actions_cron.lock';
|
$LOCK_FILE='/var/run/alternc/do_actions_cron.lock';
|
||||||
$SCRIPT='/usr/bin/php do_actions.php';
|
$SCRIPT='/usr/bin/php do_actions.php';
|
||||||
$MY_PID=getmypid();
|
$MY_PID=getmypid();
|
||||||
|
|
|
@ -32,6 +32,7 @@ mysql_query() { /usr/bin/mysql --defaults-file=/etc/alternc/my.cnf -Bs -e "$@" ;
|
||||||
DOMAIN_LOG_FILE="/var/log/alternc/update_domains.log"
|
DOMAIN_LOG_FILE="/var/log/alternc/update_domains.log"
|
||||||
VHOST_FILE="$VHOST_DIR/vhosts_all.conf"
|
VHOST_FILE="$VHOST_DIR/vhosts_all.conf"
|
||||||
VHOST_MANUALCONF="$VHOST_DIR/manual/"
|
VHOST_MANUALCONF="$VHOST_DIR/manual/"
|
||||||
|
LOCK_JOBS="/var/run/alternc/jobs-lock"
|
||||||
|
|
||||||
|
|
||||||
# Some useful miscellaneous shell functions
|
# Some useful miscellaneous shell functions
|
||||||
|
@ -119,3 +120,23 @@ generate_string() {
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lock_jobs() {
|
||||||
|
test -d "$(dirname "$LOCK_JOBS")" || mkdir -p "$(dirname "$LOCK_JOBS")"
|
||||||
|
touch "$LOCK_JOBS"
|
||||||
|
}
|
||||||
|
|
||||||
|
unlock_jobs() {
|
||||||
|
test -e "$LOCK_JOBS" && rm -f "$LOCK_JOBS"
|
||||||
|
}
|
||||||
|
|
||||||
|
are_jobs_locked() {
|
||||||
|
return $(test -e "$LOCK_JOBS")
|
||||||
|
}
|
||||||
|
|
||||||
|
stop_if_jobs_locked() {
|
||||||
|
are_jobs_locked || return
|
||||||
|
echo "There is a file $LOCK_JOBS"
|
||||||
|
echo "So no jobs are allowed, not even for $0"
|
||||||
|
echo "Did you launch alternc.install ?"
|
||||||
|
exit 42
|
||||||
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
*/
|
*/
|
||||||
require_once("/usr/share/alternc/panel/class/config_nochk.php");
|
require_once("/usr/share/alternc/panel/class/config_nochk.php");
|
||||||
|
|
||||||
|
$admin->stop_if_jobs_locked();
|
||||||
|
|
||||||
# Be super user
|
# Be super user
|
||||||
#$mem->setid(2000);
|
#$mem->setid(2000);
|
||||||
$admin->enabled=1;
|
$admin->enabled=1;
|
||||||
|
|
|
@ -14,6 +14,8 @@ for CONFIG_FILE in \
|
||||||
. "$CONFIG_FILE"
|
. "$CONFIG_FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
stop_if_jobs_locked
|
||||||
|
|
||||||
# Some vars
|
# Some vars
|
||||||
umask 022
|
umask 022
|
||||||
LOCK_FILE="/usr/share/alternc/panel/cron.lock" # FIXME doesn't seem clean to be here
|
LOCK_FILE="/usr/share/alternc/panel/cron.lock" # FIXME doesn't seem clean to be here
|
||||||
|
|
|
@ -13,6 +13,8 @@ for CONFIG_FILE in \
|
||||||
. "$CONFIG_FILE"
|
. "$CONFIG_FILE"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
stop_if_jobs_locked
|
||||||
|
|
||||||
LOCK_FILE="/var/run/alternc/update_mails"
|
LOCK_FILE="/var/run/alternc/update_mails"
|
||||||
|
|
||||||
# ALTERNC_MAIL is from local.sh
|
# ALTERNC_MAIL is from local.sh
|
||||||
|
|
Loading…
Reference in New Issue