diff options
author | 2008-01-06 07:05:55 +0000 | |
---|---|---|
committer | 2008-01-06 07:05:55 +0000 | |
commit | 91cae4e0987b44313ebb091bb1cd376130c5a4be (patch) | |
tree | 645f3663e909d45fa5636e27a618a77db2644716 | |
parent | move code that talks to server into talk_to_server(), which forks before doin... (diff) | |
download | scire-91cae4e0987b44313ebb091bb1cd376130c5a4be.tar.gz scire-91cae4e0987b44313ebb091bb1cd376130c5a4be.tar.bz2 scire-91cae4e0987b44313ebb091bb1cd376130c5a4be.zip |
condense check_job_dir() with a loop
svn path=/branches/new-fu/; revision=331
-rwxr-xr-x | client/scireclient.pl | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/client/scireclient.pl b/client/scireclient.pl index f630f7f..2415373 100755 --- a/client/scireclient.pl +++ b/client/scireclient.pl @@ -40,6 +40,7 @@ sub talk_to_server { return $exitcode; } else { # We'll need to add a call to setuid() here at some point + #ok folks so here's how this thang goes down. #1. Connect. $comm = Scire::Communicator->new( host => $conf{host}, user => $conf{user}, port => $conf{port} ); @@ -96,25 +97,13 @@ sub parse_command_line { } sub check_job_dir { - if (! -d $conf{job_dir}) { - print "WARNING! $conf{job_dir} does not exist...creating\n"; - mkpath( $conf{job_dir}, {verbose => 1, mode => 0660}) - or die("Couldn't make $conf{job_dir} w/ perms 0660: $!"); - } - if (! -d "$conf{job_dir}/queue") { - print "WARNING! $conf{job_dir}/queue does not exist...creating\n"; - mkpath( "$conf{job_dir}/queue", {verbose => 1, mode => 0660}) - or die("Couldn't make $conf{job_dir}/queue w/ perms 0660: $!"); - } - if (! -d "$conf{job_dir}/done") { - print "WARNING! $conf{job_dir}/done does not exist...creating\n"; - mkpath( "$conf{job_dir}/done", {verbose => 1, mode => 0660}) - or die("Couldn't make $conf{job_dir}/done w/ perms 0660: $!"); - } - if (! -d "$conf{job_dir}/failed") { - print "WARNING! $conf{job_dir}/failed does not exist...creating\n"; - mkpath( "$conf{job_dir}/failed", {verbose => 1, mode => 0660}) - or die("Couldn't make $conf{job_dir}/failed w/ perms 0660: $!"); + my @checkdirs = ($conf{job_dir}, "$conf{job_dir}/queue", "$conf{job_dir}/done", "$conf{job_dir}/failed"); + for my $dir (@checkdirs) { + if (! -d $dir) { + print "WARNING! ${dir} does not exist...creating\n"; + mkpath( $dir, {verbose => 1, mode => 0660}) + or die("Couldn't make ${dir} w/ perms 0660: $!"); + } } } |