summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPreston Cody <codeman@gentoo.org>2007-12-24 00:21:22 +0000
committerPreston Cody <codeman@gentoo.org>2007-12-24 00:21:22 +0000
commit759cbf7249ff7871567efb3e261f7098c4a81bde (patch)
tree7528de472a21089b64729cad19b1508308bef487
parentadd servercmd comment (diff)
downloadscire-759cbf7249ff7871567efb3e261f7098c4a81bde.tar.gz
scire-759cbf7249ff7871567efb3e261f7098c4a81bde.tar.bz2
scire-759cbf7249ff7871567efb3e261f7098c4a81bde.zip
adding config-related stuff.
svn path=/branches/new-fu/; revision=254
-rwxr-xr-xclient/scireclient.pl45
-rw-r--r--etc/scire.conf5
2 files changed, 44 insertions, 6 deletions
diff --git a/client/scireclient.pl b/client/scireclient.pl
index 9bf7aed..e1f287c 100755
--- a/client/scireclient.pl
+++ b/client/scireclient.pl
@@ -5,20 +5,53 @@ use warnings;
use IPC::Open2;
-my $jobdir = "/tmp/scirejobs";
+use constant SCIRE_CONFIG_FILE => '/etc/scire.conf';
+#Constants to be defined in /etc/scire.conf
+
+my $conf;
+read_config();
+
+#Read command line options.
+
+# Build the connection command.
# This will eventually be something like "ssh scire@${scireserver} /usr/bin/scireserver.pl"
-my $servercmd = "../server/scireserver.pl";
+my $connection_command = "ssh ";
+if (defined($conf{port})) {
+ $connection_command .= "-o Port=$conf{port} ";
+}
+$connection_command .= "$conf{user}\@$conf{host} $conf{server_script}";
-if(! -d $jobdir) {
- print "WARNING! ${jobdir} does not exist...creating\n";
- mkdir $jobdir, 0660;
+#my $servercmd = "../server/scireserver.pl";
+
+if(! -d $conf{job_dir}) {
+ print "WARNING! $conf{job_dir} does not exist...creating\n";
+ mkdir $conf{job_dir}, 0660;
}
-my $pid = open2(*server_stdout, *server_stdin, $servercmd);
+my $pid = open2(*server_stdout, *server_stdin, $connection_command);
+sub run_main {
+ #ok folks so here's how this thang goes down.
+ #1. Connect.
+ #2. Register with the DB. (only it knows if you're allowed to be active)
+ #3. Scan the jobs directory. If there are done/failed jobs, report them. Note jobs in running or queue.
+ #4. Fetch the jobs list
+ #5. ?
+ #
for(('PING', 'FOO', 'QUIT')) {
print "Sending: $_\n";
print server_stdin "$_\n";
my $response = <server_stdout>;
print "Got: ${response}";
}
+
+sub read_config {
+ my FH = open(SCIRE_CONFIG_FILE) or die("Couldn't open the config ".${\SCIRE_CONFIG_FILE}." : $!");
+ while (<FH>) {
+ chomp( my $line = $_);
+ next if /^\s*(?:#|$)/;
+ my ($key,$val) = split /=/;
+ $conf{lc($key)} = $val;
+ }
+ close(FH) or die("Couldn't close the config ".${\SCIRE_CONFIG_FILE}." : $!");
+}
diff --git a/etc/scire.conf b/etc/scire.conf
new file mode 100644
index 0000000..e205453
--- /dev/null
+++ b/etc/scire.conf
@@ -0,0 +1,5 @@
+HOST=localhost
+PORT=22
+USERNAME=scire
+SERVER_SCRIPT=../server/scireserver.pl
+JOB_DIR=/tmp/scirejobs