if i wanted to ping all the machines in a given directory (/etc/hosts) and return a total count of responses how would i go about scripting that?
complete newbie...so be gentle
if ; then //$1 = /etc/hosts
cd "$1"
//this puts me into the directory i need...but how do i send ... (2 Replies)
I would have searched for this but I couldn't really think of what to use for the search text...
I've got a situation where I need to automate responses to an executable when running it from a script so that it can be made into a job the operators don't have to interact with. When I run it... (2 Replies)
Unfortunately googling the word 'chat' gives you zebedee billion responses that relate to everything and few of them refer to the linux chat command. I've read the man page and found a couple of examples but can't see how to do this.
I want to query the modem for it's manufacturer, product id... (8 Replies)
Hello,
I am trying to count how many times a subject makes a correct switch or a correct stay response in a simple task. I have data on which condition they were in (here, labeled "IMAGINE" and "RECALL"), as well as whether they made a left or right button response, and whether the outcome was... (5 Replies)
Hello,
I'm looking for an awk one-liner that prints the first two data fields, then contains a conditional where if $3>$4, it prints $3-$4. Otherwise, it prints $3. Example:
Data file:
123,456,999,888
333,222,444,555
654,543,345,888
444,777,333,111
Output:
123,456,111
333,222,444... (2 Replies)
Greetings,
I've got a Zenoss v2.5 server monitoring a large video encoding farm. Needless to say, these systems are under high bandwidth and CPU utilization the majority of the time.
What I'm running into is that, occasionally, these systems will fail to respond to a standard SNMP request,... (1 Reply)
Hey everyone,
Okay, so I've been having some fun with the dig command, and wanted to dig my old school. Two questions came up from this. So I:
dig @8.8.8.8 +recurse njcu.edu ANY
and the result is about 8 records, including the SOA record. One of them is this weird TXT record, and the other is... (1 Reply)
I have two Linux machines, Linux1 and Linux2. They both have two NFS mounts. We'll call them /scratch1 and /scratch2. And they both reside on the same NetApp filer. If I copy a 512Mb file from /scratch1 to /scratch2 while logged on Linux1 it takes 40s. However if I scp this file from... (1 Reply)
So first: Sorry if the title is confusing...
I have a script I'm writing with a file with several names in it (some other info - but it's not really pertinent...) - I want to be allow the user to delete certain records, but I ran into a problem I'm not sure how to go about fixing.
If I were... (6 Replies)
Discussion started by: sabster
6 Replies
LEARN ABOUT PHP
rar_open
RAR_OPEN(3) 1 RAR_OPEN(3)RarArchive::open - Open RAR archive
Object oriented style (method):
SYNOPSIS
publicstatic RarArchive RarArchive::open (string $filename, [string $password = NULL], [callable $volume_callback = NULL])
DESCRIPTION
Procedural style:
RarArchive rar_open (string $filename, [string $password = NULL], [callable $volume_callback = NULL])
Open specified RAR archive and return RarArchive instance representing it.
Note
If opening a multi-volume archive, the path of the first volume should be passed as the first parameter. Otherwise, not all files
will be shown. This is by design.
PARAMETERS
o $filename
- Path to the Rar archive.
o $password
- A plain password, if needed to decrypt the headers. It will also be used by default if encrypted files are found. Note that the
files may have different passwords in respect to the headers and among them.
o $volume_callback
- A function that receives one parameter - the path of the volume that was not found - and returns a string with the correct path
for such volume or NULL if such volume does not exist or is not known. The programmer should ensure the passed function doesn't
cause loops as this function is called repeatedly if the path returned in a previous call did not correspond to the needed volume.
Specifying this parameter omits the notice that would otherwise be emitted whenever a volume is not found; an implementation that
only returns NULL can therefore be used to merely omit such notices.
Warning
Prior to version 2.0.0, this function would not handle relative paths correctly. Use realpath(3) as a workaround.
RETURN VALUES
Returns the requested RarArchive instance or FALSE on failure.
CHANGELOG
+--------+-----------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+-----------------------------+
| 3.0.0 | |
| | |
| | $volume_callback was added. |
| | |
+--------+-----------------------------+
EXAMPLES
Example #1
Object oriented style
<?php
$rar_arch = RarArchive::open('encrypted_headers.rar', 'samplepassword');
if ($rar_arch === FALSE)
die("Failed opening file");
$entries = $rar_arch->getEntries();
if ($entries === FALSE)
die("Failed fetching entries");
echo "Found " . count($entries) . " files.
";
if (empty($entries))
die("No valid entries found.");
$stream = reset($entries)->getStream();
if ($stream === FALSE)
die("Failed opening first file");
$rar_arch->close();
echo "Content of first one follows:
";
echo stream_get_contents($stream);
fclose($stream);
?>
The above example will output something similar to:
Found 2 files.
Content of first one follows:
Encrypted file 1 contents.
Example #2
Procedural style
<?php
$rar_arch = rar_open('encrypted_headers.rar', 'samplepassword');
if ($rar_arch === FALSE)
die("Failed opening file");
$entries = rar_list($rar_arch);
if ($entries === FALSE)
die("Failed fetching entries");
echo "Found " . count($entries) . " files.
";
if (empty($entries))
die("No valid entries found.");
$stream = reset($entries)->getStream();
if ($stream === FALSE)
die("Failed opening first file");
rar_close($rar_arch);
echo "Content of first one follows:
";
echo stream_get_contents($stream);
fclose($stream);
?>
Example #3
Volume Callback
<?php
/* In this example, there's a volume named multi_broken.part1.rar
* whose next volume is named multi.part2.rar */
function resolve($vol) {
if (preg_match('/_broken/', $vol))
return str_replace('_broken', '', $vol);
else
return null;
}
$rar_file1 = rar_open(dirname(__FILE__).'/multi_broken.part1.rar', null, 'resolve');
$entry = $rar_file1->getEntry('file2.txt');
$entry->extract(null, dirname(__FILE__) . "/temp_file2.txt");
?>
SEE ALSO
rar:// wrapper.
PHP Documentation Group RAR_OPEN(3)