Hey guys,
Trying to figure out why my "not equals" operator doesn't work in this OR statement:
#!/usr/bin/env python3
import sys
readyprompt = input("Are you ready? [y/n]\n>")
ans = readyprompt.lower()
if ans != "y" or ans != "yes":
print("Quitting. Please run " + sys.argv[0] +...
Hi rvBasic,
Thanks for your suggestion. I tried that and my output file is still raw data instead of a tar archive. Any other ideas?
[root@twantrd tmp]# file backup.tar
backup.tar: data
Hey guys,
I'm trying to write a perl socket daemon that will listen on a port and accepts a data connection via a tar piped with netcat for backups. The client will run this command:
tar cvf - tartest | nc 192.168.1.10 9999
my perl code is here:
#!/usr/bin/perl -w
use strict;
use...
Sorry, pasted the wrong one. This is the correct one:
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
my $rounded=58.333333;
#$rounded =~ /\d{1,2}\.\d{2}/;
#$rounded =~ /^\d\d\.\d\d$/;
my $value = $rounded =~ /^\d\d\.\d\d$/;
print "The rounded percentage is: $value" . "%\n"...
Hey all,
I've been reading how to restrict digits to a certain length and I don't see the error.
#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
my $rounded=58.333333;
#$rounded =~ /^\d\d\.\d\d$/; # one solution
$rounded =~ /^\d{2}\.\d{2}/; # another solution
print "Rounded...
Ok, I think I found the problem. The script works fine on a linux server but not on this storage device. Perl is messed up somehow on this unit. Thanks for the help everyone!
-twantrd
Sorry, yes, this is a question. I'm wondering why my statement doesn't print anything when all drives are healthy. If everything is healthy, it should print "OK".
Kirsle,
I tried your if statement and the results are the same.
The contents of the file, /tmp/drive_stats looks like this:
Bay...
Hi,
I'm writing a simple check for a jbod device. If all the drives come back with a status sign of "HEALTHY" then I print an "OK" statement. If it doesn't come with that status, then I print "CRITICAL". Very simple. My script prints CRITICAL when the condition is met but it doesn't print...
Thanks for spotting that out, Kevin. But, how do I save it so that it prints out ALL matching strings? I tried putting that in an array and it still emails me with nothing in the body. Thank you for your help.
-twantrd
Hi there,
I'm trying to match a list of items and using sendmail to mail me only those matching strings from a file. This is the code I have so far:
use FileHandle;
my $match;
# Grab the filenames that have been downloaded
open (FILENAME, "<$logfile");
while (my $match=<FILENAME>) {...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.