Move lock files to /lock to allow multiple instances
This commit is contained in:
parent
f6f524f2be
commit
aa571ec45f
|
@ -28,6 +28,7 @@ $script_path = $config_dir."/scripts/";
|
|||
$CONFIG = include($config_file);
|
||||
|
||||
$logdir=$spooldir.'/log';
|
||||
$lockdir=$spooldir.'/lock';
|
||||
|
||||
ini_set('error_reporting', E_ERROR );
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
if(filemtime($spooldir.'/'.$config_name.'-expire-timer')+86400 > time()) {
|
||||
exit;
|
||||
}
|
||||
$lockfile = sys_get_temp_dir() . '/'.$config_name.'-spoolnews.lock';
|
||||
$lockfile = $lockdir . '/'.$config_name.'-spoolnews.lock';
|
||||
$pid = file_get_contents($lockfile);
|
||||
if (posix_getsid($pid) === false || !is_file($lockfile)) {
|
||||
print "Starting expire...\n";
|
||||
|
|
|
@ -27,7 +27,7 @@ $logfile=$logdir.'/import.log';
|
|||
$workpath=$spooldir."/";
|
||||
$path=$workpath."articles/";
|
||||
|
||||
$lockfile = sys_get_temp_dir() . '/'.$config_name.'-spoolnews.lock';
|
||||
$lockfile = $lockdir . '/'.$config_name.'-spoolnews.lock';
|
||||
$pid = file_get_contents($lockfile);
|
||||
if (posix_getsid($pid) === false || !is_file($lockfile)) {
|
||||
print "Starting Import...\n";
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
include $config_dir."/scripts/rslight-lib.php";
|
||||
if(file_exists($config_dir."/nntp.disable")) {
|
||||
clearstatcache(true, $config_dir."/nntp.disable");
|
||||
$parent_pid = file_get_contents(sys_get_temp_dir().'/rslight-nntp.lock', IGNORE_NEW_LINES);
|
||||
$parent_pid = file_get_contents($lockdir.'/rslight-nntp.lock', IGNORE_NEW_LINES);
|
||||
posix_kill($parent_pid, SIGTERM);
|
||||
exit;
|
||||
}
|
||||
|
@ -57,10 +57,10 @@
|
|||
{
|
||||
GLOBAL $__server_listening;
|
||||
GLOBAL
|
||||
$CONFIG,$logdir,$webserver_uid,$webserver_gid,$installed_path,
|
||||
$CONFIG,$logdir,$lockdir,$webserver_uid,$webserver_gid,$installed_path,
|
||||
$config_path,$groupconfig,$workpath,$path,$spooldir,$nntp_group,$auth_ok;
|
||||
$logfile=$logdir.'/nntp.log';
|
||||
$lockfile = sys_get_temp_dir() . '/rslight-nntp-ssl.lock';
|
||||
$lockfile = $lockdir . '/rslight-nntp-ssl.lock';
|
||||
$pid = file_get_contents($lockfile);
|
||||
if (posix_getsid($pid) === false || !is_file($lockfile)) {
|
||||
print "Starting Rocksolid Light NNTP Server...\n";
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
include $config_dir."/scripts/rslight-lib.php";
|
||||
if(file_exists($config_dir."/nntp.disable")) {
|
||||
clearstatcache(true, $config_dir."/nntp.disable");
|
||||
$parent_pid = file_get_contents(sys_get_temp_dir().'/rslight-nntp.lock', IGNORE_NEW_LINES);
|
||||
$parent_pid = file_get_contents($lockdir.'/rslight-nntp.lock', IGNORE_NEW_LINES);
|
||||
posix_kill($parent_pid, SIGTERM);
|
||||
exit;
|
||||
}
|
||||
|
@ -56,11 +56,11 @@
|
|||
function server_loop($address, $port)
|
||||
{
|
||||
GLOBAL $__server_listening;
|
||||
GLOBAL
|
||||
$CONFIG,$logdir,$webserver_uid,$webserver_gid,$installed_path,
|
||||
GLOBAL
|
||||
$CONFIG,$logdir,$lockdir,$webserver_uid,$webserver_gid,$installed_path,
|
||||
$config_path,$groupconfig,$workpath,$path,$spooldir,$nntp_group,$auth_ok;
|
||||
$logfile=$logdir.'/nntp.log';
|
||||
$lockfile = sys_get_temp_dir() . '/rslight-nntp.lock';
|
||||
$lockfile = $lockdir . '/rslight-nntp.lock';
|
||||
$pid = file_get_contents($lockfile);
|
||||
if (posix_getsid($pid) === false || !is_file($lockfile)) {
|
||||
print "Starting Rocksolid Light NNTP Server...\n";
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
$lockfile = sys_get_temp_dir() . '/rslight-spoolnews.lock';
|
||||
$lockfile = $lockdir . '/rslight-spoolnews.lock';
|
||||
$pid = file_get_contents($lockfile);
|
||||
if (posix_getsid($pid) === false || !is_file($lockfile)) {
|
||||
print "Starting nocem...\n";
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
function interact($msgsock, $use_crypto=false)
|
||||
{
|
||||
global $CONFIG,$logdir,$logfile,$installed_path,$config_path,$config_dir,$groupconfig,$workpath,$path, $spooldir,$nntp_group,$nntp_article,$auth_ok,$user,$pass;
|
||||
global $CONFIG,$logdir,$lockdir,$logfile,$installed_path,$config_path,$config_dir,$groupconfig,$workpath,$path, $spooldir,$nntp_group,$nntp_article,$auth_ok,$user,$pass;
|
||||
|
||||
$workpath=$spooldir."/";
|
||||
$path=$workpath."articles/";
|
||||
|
@ -29,7 +29,7 @@
|
|||
set_time_limit(30);
|
||||
$buf = fgets($msgsock, 2048);
|
||||
if(file_exists($config_dir."/nntp.disable")) {
|
||||
$parent_pid = file_get_contents(sys_get_temp_dir().'/rslight-nntp.lock', IGNORE_NEW_LINES);
|
||||
$parent_pid = file_get_contents($lockdir.'/rslight-nntp.lock', IGNORE_NEW_LINES);
|
||||
posix_kill($parent_pid, SIGTERM);
|
||||
exit;
|
||||
}
|
||||
|
@ -953,9 +953,9 @@ function encode_subject($line) {
|
|||
|
||||
function insert_article($section,$nntp_group,$filename,$subject_i,$from_i,$article_date,
|
||||
$date_i,$mid_i,$references_i,$bytes_i,$lines_i,$xref_i,$body) {
|
||||
global $enable_rslight,$spooldir,$CONFIG,$logdir,$logfile;
|
||||
global $enable_rslight,$spooldir,$CONFIG,$logdir,$lockdir,$logfile;
|
||||
|
||||
$sn_lockfile = sys_get_temp_dir() . '/'.$section.'-spoolnews.lock';
|
||||
$sn_lockfile = $lockdir . '/'.$section.'-spoolnews.lock';
|
||||
$sn_pid = file_get_contents($sn_lockfile);
|
||||
if (posix_getsid($sn_pid) === false || !is_file($sn_lockfile)) {
|
||||
file_put_contents($sn_lockfile, getmypid()); // create lockfile
|
||||
|
|
|
@ -29,7 +29,7 @@ $logfile=$logdir.'/spoolnews.log';
|
|||
|
||||
@mkdir($spooldir."/".$config_name,0755,'recursive');
|
||||
|
||||
$lockfile = sys_get_temp_dir() . '/rslight-send.lock';
|
||||
$lockfile = $lockdir . '/rslight-send.lock';
|
||||
$pid = file_get_contents($lockfile);
|
||||
if (posix_getsid($pid) === false || !is_file($lockfile)) {
|
||||
print "Starting Send...\n";
|
||||
|
|
|
@ -46,7 +46,7 @@ if(!isset($CONFIG['enable_nntp']) || $CONFIG['enable_nntp'] != true) {
|
|||
$workpath=$spooldir."/";
|
||||
$path=$workpath."articles/";
|
||||
|
||||
$lockfile = sys_get_temp_dir() . '/'.$config_name.'-spoolnews.lock';
|
||||
$lockfile = $lockdir . '/'.$config_name.'-spoolnews.lock';
|
||||
$pid = file_get_contents($lockfile);
|
||||
if (posix_getsid($pid) === false || !is_file($lockfile)) {
|
||||
print "Starting Spoolnews...\n";
|
||||
|
|
Loading…
Reference in New Issue