diff options
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/rhrd-sanity-check | 27 | ||||
-rwxr-xr-x | utils/rhrd-show | 22 |
2 files changed, 34 insertions, 15 deletions
diff --git a/utils/rhrd-sanity-check b/utils/rhrd-sanity-check index 9dc5c43..93d933e 100755 --- a/utils/rhrd-sanity-check +++ b/utils/rhrd-sanity-check @@ -262,7 +262,20 @@ sub check_groups } -sub check_logs +sub check_dropboxes +{ + my ($ctx) = @_; + + my $errors = 0; + print "dropboxes:\n"; + + print "\n " . $errors . " errors found\n"; + + return $errors; +} + + +sub check_showids { my ($ctx) = @_; @@ -276,12 +289,12 @@ sub check_logs } -sub check_dropboxes +sub check_logs { my ($ctx) = @_; - my $errors = 0; - print "dropboxes:\n"; + my $errors = 0, + print "logs:\n"; print " ... checks not yet implemtned!!\n"; print "\n " . $errors . " errors found\n"; @@ -294,9 +307,11 @@ my ($ctx, $status, $errorstring) = RHRD::rddb::init(); if(defined $ctx) { check_groups($ctx); print "\n"; - check_logs($ctx); - print "\n"; check_dropboxes($ctx); + print "\n"; + check_showids($ctx); + print "\n"; + check_logs($ctx); RHRD::rddb::destroy($ctx); } else { diff --git a/utils/rhrd-show b/utils/rhrd-show index 3431450..7cb8422 100755 --- a/utils/rhrd-show +++ b/utils/rhrd-show @@ -23,6 +23,7 @@ use strict; use lib "../lib/"; use RHRD::rddb; +use RHRD::utils; # this is ridiculous but makes it a little harder to create/remove users... # if ($> != 0 ) { @@ -90,24 +91,27 @@ sub add__check_arguments return 1; } - if($rhythm !~ m/^[01]{4}$/ || $rhythm eq '0000') { - print STDERR "rhythm '" . $rhythm . "' contains illegal characters or is too long/short\n"; - print STDERR " only 0 or 1 are allowed and, length must be exactly 4 and it must not be '0000'\n"; + my ($result, $err, $hint) = RHRD::utils::dropbox_param_rhythm_ok($rhythm); + unless($result) { + print STDERR $err . "\n " . $hint . "\n"; return 1; } - if($dow < 1 || $dow > 7) { - print STDERR "dow '" . $dow . "' is out of range, must be between 1 and 7 (1=Monday, ..., 7=Sunday)\n"; + ($result, $err, $hint) = RHRD::utils::dropbox_param_dow_ok($dow); + unless($result) { + print STDERR $err . "\n " . $hint . "\n"; return 1; } - if($starttime !~ m/^[0-2][0-9][0-5][0-9]$/ || $starttime > 2359) { - print STDERR "starttime '" . $starttime . "' is not a valid time must be HHMM\n"; + ($result, $err, $hint) = RHRD::utils::dropbox_param_starttime_ok($starttime); + unless($result) { + print STDERR $err . "\n " . $hint . "\n"; return 1; } - if($len <= 0) { - print STDERR "len '" . $len . "' must be > 0\n"; + ($result, $err, $hint) = RHRD::utils::dropbox_param_len_ok($len); + unless($result) { + print STDERR $err . "\n " . $hint . "\n"; return 1; } |