diff --git a/checkin_notes b/checkin_notes index 3d8cbf1a4e..c6f470f707 100755 --- a/checkin_notes +++ b/checkin_notes @@ -6982,3 +6982,12 @@ Rom 23 May 2005 client/ app_graphics.C + +David 23 May 2005 + - added entry to sched config file (optional). + Specifies where scheduler PID lockfiles are kept + (default is cgi-bin dir) + + sched/ + handle_request.C + sched_config.C,h diff --git a/doc/configuration.php b/doc/configuration.php index d0156473da..c07b729eb8 100644 --- a/doc/configuration.php +++ b/doc/configuration.php @@ -51,6 +51,7 @@ htmlspecialchars(" [ N ] [ N ] [ N ] + [ path ] @@ -122,6 +123,8 @@ features on the administrative pages. Note: enabling 'grep logs' with very long log files can hang your server, since grepping GB files can take a long time. If you enable this feature, be sure to rotate the logs so that they are not too big."); +list_item("sched_lockfile_dir", "Directory where scheduler lockfiles + are stored. Must be writeable to the Apache user."); list_end(); echo " diff --git a/sched/handle_request.C b/sched/handle_request.C index bf58967d00..39f8a74dcc 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -57,21 +57,28 @@ using namespace std; // instance for this host. Return values same as mylockf(). // int lock_sched(SCHEDULER_REPLY& reply) { - char filename[64]; + char filename[256]; char pid_string[16]; int fd, pid, count; reply.lockfile_fd=-1; - sprintf(filename, "CGI_%07d", reply.host.id); + if (strlen(config.sched_lockfile_dir)) { + sprintf(filename, "%s/CGI_%07d", config.sched_lockfile_dir, reply.host.id); + } else { + sprintf(filename, "CGI_%07d", reply.host.id); + } - if ((fd=open(filename, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH))<0) return -1; + fd = open(filename, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); + if (fd < 0) return -1; - // if we can't get an advisory write lock on the file, return the PID - // of the process that DOES hold the lock. + // if we can't get an advisory write lock on the file, + // return the PID of the process that DOES hold the lock. + // if ((pid=mylockf(fd))) return pid; // write PID into the CGI_ file and flush to disk + // count=sprintf(pid_string, "%d\n", getpid()); write(fd, pid_string, count); fsync(fd); diff --git a/sched/sched_config.C b/sched/sched_config.C index dd07ba63be..0c6a4766ca 100644 --- a/sched/sched_config.C +++ b/sched/sched_config.C @@ -69,6 +69,7 @@ int SCHED_CONFIG::parse(char* buf) { parse_str(buf, "", download_dir_alt, sizeof(download_dir_alt)); parse_str(buf, "", upload_url, sizeof(upload_url)); parse_str(buf, "", upload_dir, sizeof(upload_dir)); + parse_str(buf, "", sched_lockfile_dir, sizeof(sched_lockfile_dir)); parse_bool(buf, "one_result_per_user_per_wu", one_result_per_user_per_wu); parse_bool(buf, "non_cpu_intensive", non_cpu_intensive); parse_bool(buf,"homogeneous_redundancy", homogeneous_redundancy); diff --git a/sched/sched_config.h b/sched/sched_config.h index 45124d65e1..cf8515a59a 100644 --- a/sched/sched_config.h +++ b/sched/sched_config.h @@ -38,6 +38,7 @@ public: // (file deleter looks here if not in main dir) char upload_url[256]; char upload_dir[256]; + char sched_lockfile_dir[256]; bool one_result_per_user_per_wu; bool msg_to_host; int min_sendwork_interval;