Sponsored Content
Top Forums Shell Programming and Scripting Capture http response code from wget Post 302472596 by frans on Wednesday 17th of November 2010 02:17:31 PM
Old 11-17-2010
(($?==202)) will return 0 if $? is 202
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

wget using wildcards using http

Hi there, probably a really simple question but i want to download all .rpm files from a web repository which happens to be http and not ftp Ive tried using wget, but as far as i can see it doesnt allow for wilcards (ie wget http://address/*.rpm) does anybody know i can get all these files in... (2 Replies)
Discussion started by: hcclnoodles
2 Replies

2. Shell Programming and Scripting

Response Code using wget in shell

I am trying to get the status code of a web request,size of the download file and response time using wget. When i use the command: wget <sitename> ,it gives all these parameters in the command line.But i want to get these values seperately and assign in different variables using shell script.Is... (2 Replies)
Discussion started by: rajbal
2 Replies

3. UNIX for Dummies Questions & Answers

cant make a http get request using wget

Hi all, Im trying to make an http get request to a web service from a linux machine like below and i get ERROR 500 wget http://10.1.21.236:8585/pns.asmx/Sen...&msgBody=werty 25018 $ --19:06:32-- http://10.1.21.236:8585/pns.asmx/Sen...erName=serverA Connecting to 10.1.21.236:8585...... (1 Reply)
Discussion started by: elthox
1 Replies

4. Shell Programming and Scripting

Capture RSA fingerprint from ssh response

Hi. I'm trying to automate access to an Amazon Web Services machine instance. What this means is that my script is trying to use ssh to connect to a new server every time. I know the RSA fingerprint of my new server through an out-of-band channel. I would like to capture the RSA fingerprint... (0 Replies)
Discussion started by: chorlton
0 Replies

5. Shell Programming and Scripting

Unable to access http site using wget through proxy

Hi there I am currently trying to access an http site using the wget utility from a solaris box. I am going through proxies to do this and we have two types of proxies. For the first one, which is a netcache proxy, I am able to use the wget command to export the proxy information export... (2 Replies)
Discussion started by: memonks
2 Replies

6. Programming

how to capture OS name using C/C++ code

Hi, I want to know the os name via c/c++ source code.so please help me to do the same. I will appreciate if anyone can provide me the source code. Thanks in advance.. (9 Replies)
Discussion started by: smartgupta
9 Replies

7. Solaris

HTTP error while downloading solaris patches using wget

Hello, I am getting a HTTP error while downloading solaris patches using wget. 'Downloading unsigned patch 113096-03. --2010-06-18 03:51:15-- http://sunsolve.sun.com/pdownload.pl?target=113096-03&method=h Resolving sunsolve.sun.com (sunsolve.sun.com)... 192.18.108.40 Connecting to... (5 Replies)
Discussion started by: sunny_a_j
5 Replies

8. Shell Programming and Scripting

WGET command retrying to get response

Hi , Iam using " WGET " command to hit the URL,i.e. servlet url. I can trigger the servlet using wget but when servlet is not responding this command retries automatically until it get the positive response from the server. So this script is running for more than 8 hrs to get the positive... (2 Replies)
Discussion started by: vinothsekark
2 Replies

9. Red Hat

Getting the response code and to know whether web site is loaded

Hi Guys, Is there any way that we can know whether a website is fullly loaded with Linux command line ?? is there any command in Linux that can achieve that ?? Also,naturally I would also like to get the response code of the particular website/URL that i am testing for ?? Any help would be... (3 Replies)
Discussion started by: Pradeep_1990
3 Replies

10. Shell Programming and Scripting

Check wget return code

hello check this script it jump to else part, in n both cases, (if files exist or not) wget $MIRROR/kkk.zip && wget $MIRROR/jjj.zip RC="$?" if ] then echo -e "$RED Ooops, Download links are broken...! $RESET" else echo -e "$GREEN Everything is fine, Cheers ... $RESET" fi (4 Replies)
Discussion started by: nimafire
4 Replies
POE::Queue(3pm) 					User Contributed Perl Documentation					   POE::Queue(3pm)

NAME
POE::Queue - a flexible, generic priority queue API SYNOPSIS
POE::Queue specifies additional methods not illustrated here. #!perl use warnings; use strict; use POE::Queue::Array; my $pqa = POE::Queue::Array->new(); # Enqueue a few items. foreach my $priority (505, 404, 303, 202, 101) { $pqa->enqueue($priority, "payload $priority"); } # Dequeue until the queue is drained. while(1) { my ($priority, $queue_id, $payload) = $pqa->dequeue_next(); last unless defined $priority; print( "dequeued id($queue_id) ", "priority($priority) ", "payload($payload) ", ); } Sample output: dequeued id(5) priority(101) payload(payload 101) dequeued id(4) priority(202) payload(payload 202) dequeued id(3) priority(303) payload(payload 303) dequeued id(2) priority(404) payload(payload 404) dequeued id(1) priority(505) payload(payload 505) DESCRIPTION
Priority queues may be implemented a number of ways, but they tend to behave similar to lists that are kept in order by some kind of "priority". Enqueued items are stored such that the "next" item to be retrieved is the one with the highest priority. Subsequent fetches return the next lowest priority, and so on, until the queue is emptied. Priority queues (also known as priority heaps) attempt to do this while consuming the fewest resources. Go read about it! It's fascinating stuff! POE::Queue Items POE::Queue items consist of three fields: A priority, a unique ID assigned at enqueue time, and a payload. The priority and payload are specified by the caller, and the unique ID is generated by POE::Queue when an item is enqueued. POE::Queue imposes two limitations on priorities: Priorities must be numeric, and lower numbers indicate higher priorities. Aside from that, POE::Queue doesn't care what the numbers mean. Unique IDs are handles into the queue. POE::Queue generates and returns them as new items are enqueued. Some methods manipulate items, and they take IDs to identify the items to alter. Item payloads are arbitrary application data. POE::Queue does not examine or alter payloads itself. Any methods that need to examine payloads will accept a filter function. Filter functions examine payloads so POE::Queue need not. Public Methods POE::Queue is an API specification. Subclasses like POE::Queue::Array provide actual implementations. new Creates a new priority queue. Returns a reference to the queue. my $queue = POE::Queue::Array->new(); enqueue PRIORITY, PAYLOAD Enqueues a PAYLOAD, which can be just about anything that will fit into a Perl scalar, at a particular PRIORITY level. enqueue() returns a unique ID which can be used to manipulate the payload or its priority directly. Following the UNIX tradition, lower priority numbers indicate higher priorities. The payload with the lowest priority number will be dequeued first. If two payloads have the same PRIORITY, then they will be dequeued in the order in which they were enqueued. In this example, a queue is used to manage a number of alarms. The "next" alarm will be the one due soonest. my $payload_id = $queue->enqueue($alarm_time, [ "stuff" ]); dequeue_next Removes the next item from the queue, returning it as three fields: priority, ID and payload. The "next" item is the one with the lowest priority number. If multiple items exist with the same priority, dequeue_next() will return the one that was given the priority first. ITEM: while(1) { my ($priority, $id, $payload) = $queue->dequeue_next(); last ITEM unless defined $priority; ...; } get_next_priority Returns the priority of the item at the head of the queue. This is the lowest numeric priority in the queue. get_next_priority() can be useful for checking the queue to see if it's time to dequeue some items. In this case, the queue manages multiple alarms, and there's nothing to do if the next alarm isn't due yet. ALARM: while(1) { my $next_alarm_time = $queue->get_next_priority(); last ALARM unless defined $next_alarm_time; if ($next_alarm_time - time() > 0) { sleep($next_alarm_time - time()); } my ($priority, $id, $payload) = $queue->dequeue_next(); ...; } get_item_count Returns the number of items in the queue. It's another way to tell whether the queue has been fully drained. Here's an alternative version of the example for get_next_priority(). ALARM: while ($queue->get_item_count()) { my $next_alarm_time = $queue->get_next_priority(); if ($next_alarm_time - time() > 0) { sleep($next_alarm_time - time()); } my ($priority, $id, $payload) = $queue->dequeue_next(); ...; } remove_item ITEM_ID, FILTER_FUNCTION Removes a single item by its ID, but only if a FILTER_FUNCTION approves of the item's payload. If a payload is found with the given ITEM_ID, it is passed to FILTER_FUNCTION for examination. If FILTER_FUNCTION returns true, the item is removed from the queue and is returned as three fields. my ($priority, $id, $payload) = $queue->remove_item( $target_id, &monkeys ); sub monkeys { my $payload = shift; $payload->{type} eq "monkey"; } The returned $priority will be undef on failure, and $! will be set to the reason why the item couldn't be removed. That will be ESRCH if the ITEM_ID was not found in the queue, or EPERM if the filter function returned false. remove_items FILTER_FUNCTION [, MAX_ITEM_COUNT ] Removes and returns items from the queue that match a FILTER_FUNCTION. remove_items() will return immediately if MAX_ITEM_COUNT items is specified and that many items have been removed from the queue. MAX_ITEM_COUNT is a bit of optimization if the application knows in advance how many items will match the FILTER_FUNCTION. Returns a list of items that were removed. Each item is an array reference containing a priority, item ID, and payload. Returns nothing if FILTER_FUNCTION matched nothing. # Remove up to 12 monkeys. my @monkeys = $queue->remove_items(&monkeys, 12); foreach my $monkey (@monkeys) { my ($priority, $id, $payload) = @$monkey; print( "Removed monkey: ", " priority = $priority ", " queue id = $id ", " payload = $payload ", ); } There is no guarantee which items will be removed if MAX_ITEM_COUNT is specified too low. peek_items FILTER_FUNCTION [, MAX_ITEM_COUNT ] peek_items() returns up to MAX_ITEM_COUNT items that match a given FILTER_FUNCTION without removing them from the queue. my @entire_queue = $queue->peek_items(sub { 1 }); foreach my $item (@entire_queue) { my ($priority, $id, $payload) = @$item; print( "Item: ", " priority = $priority ", " queue id = $id ", " payload = $payload ", ); } adjust_priority ITEM_ID, FILTER_FUNCTION, DELTA Changes the priority of an item by DELTA. The item is identified by its ITEM_ID, and the change will only happen if the item's payload satisfies a FILTER_FUNCTION. Returns the new priority, which is the previous priority + DELTA. DELTA may be negative. my $new_priority = $queue->adjust_priority( $item_id, &one_of_mine, 100 ); sub one_of_mine { my $payload = shift; return $payload->{owner} == $me; } Returns undef if the item's priority could not be adjusted, and sets $! to explain why: ESRCH means that the ITEM_ID could not be found, and EPERM means that the FILTER_FUNCTION was not satisfied. set_priority ITEM_ID, FILTER_FUNCTION, ABSOLUTE_PRIORITY Sets an item's priority to a new ABSOLUTE_PRIORITY. The item is identified by its ITEM_ID, and the change will only be allowed to happen if the item's payload satisfies a FILTER_FUNCTION. Returns the new priority, which should match ABSOLUTE_PRIORITY. Returns undef if the item's priority could not be set, and sets $! to explain why: ESRCH means that the ITEM_ID could not be found, and EPERM means that the FILTER_FUNCTION was not satisfied. my $new_priority = $queue->set_priority( $item_id, &one_of_mine, time() + 60 ); unless (defined $new_priority) { die "one of our submarines is missing: $item_id" if $! == ESRCH; die "set_priority disallowed for item $item_id" if $! == EPERM; die $!; } sub one_of_mine { $_[0]{owner} == $me; } SEE ALSO
POE, POE::Queue::Array BUGS
None known. AUTHORS &; COPYRIGHTS Please see POE for more information about authors, contributors, and POE's licensing. POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 293: A non-empty Z<> Around line 296: A non-empty Z<> perl v5.14.2 2012-05-15 POE::Queue(3pm)
All times are GMT -4. The time now is 11:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy