Sponsored Content
Full Discussion: Debug perl script
Top Forums Shell Programming and Scripting Debug perl script Post 302647491 by jamie_123 on Monday 28th of May 2012 08:34:43 AM
Old 05-28-2012
Debug perl script

Hi,

I am trying to get squid up and running using a redirector process, and every time I try to load a web page, squid fails miserably.

Can some one with perl and squid knowledge take a look at these codes and tell if something is wrong here.

Code:
#!/usr/bin/perl
#

$| = 1;

@endings = qw/ \.gif$ \.jpg$ \.jpeg$ \.png$ \.gz$ \.img$ \.tgz$ \.sit$ \.hqx$ \.image$ \.bin$ \.Z$ \.TAZ$ \.exe$ \.zip$ \.avi$ \.mov$ \.mp3$ \.mpg$ \.mpeg$ \.mov$ \.pkg$ \.wav$ \.dmg$ \.aiff$ \.pdf$ \.iso$ \.toast$ \.bz2$ \.js$ \.css$ /;
while (<>)
{
    ($url, $addr, $fqdn, $ident, $method) = m:(\S*) (\S*)/(\S*) (\S*) (\S*):;
        if ($method eq "GET")
        {
                $stop = 0;
                foreach $ending (@endings)
                {
                        if (($url =~ /$ending/i))
                        {
                                $stop = 1;
                                break;
                        }
                }
                if ($stop == 0)
                {
                        system("/opt/servers/squid_main/preget $url");
                }
        }
        print "\n";
}
# EOF

Code:
#!/bin/sh
#
# note: change 10.163.3.1:3129 to the IP and port of squid_back!
# also /tmp/targ must exist so wget stuff can be dropped there.
#
http_proxy="http://10.163.3.1:3129/"
export http_proxy
#echo "pregetting $1" >> /opt/data/squid_main/logs/myurls
wget -q --level=1 -nd  --directory-prefix=/tmp/targ/ -p "$1"
rm -rf /tmp/targ/* &
# EOF

I am trying to run the setup from here-
Code:
http://veloso.org/SquidConfig/SquidConfig.html

Thanks a lot.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

what's the debug command for perl scripts

Hi, Can you please let me know if there's any debug command for perl scripts like set -x for shell scripts (2 Replies)
Discussion started by: dayanandra
2 Replies

2. Shell Programming and Scripting

strange net::SFTP Perl module debug entry

I installed Net::sftp on a solaris 8 server and I am able to successfully transfer files to the remote server. I am running the command out of a script with debug=1 on so I can see the verbose output. The last two lines of the debug output show it couldn't fsetstat, but I don't know what that... (2 Replies)
Discussion started by: csgonan
2 Replies

3. Shell Programming and Scripting

debug this script

echo "input time in hhmmss" read $st h=`echo $st | cut -c1-2` min=`echo $st | cut -c3-4` s=`echo $st | cut -c5-6` echo "input time in hhmmss" read $end h1=`echo $end | cut -c1-2` min1=`echo $end | cut -c3-4` s1=`echo $end | cut -c5-6` x= `expr $h /* 60 + $min` y= `expr $h1 /* 60 +... (8 Replies)
Discussion started by: abhishek27
8 Replies

4. Shell Programming and Scripting

PERL: NET::FTP..>Debug Messages

HI All, NET::FTP->new($server, DEBUG=>1); I need to get all the Debug Messages in an array or a file.... Please suggest!! (0 Replies)
Discussion started by: angad.makkar
0 Replies

5. Shell Programming and Scripting

Help with debug the script

Hi, I have this script, searches and sets variables, then searches and sets more variables from multiple files. I'd need to debug it a bit. #!/bin/bash egrep $1 `find | grep MAGT` >/tmp/resRA-$$ thread=`sed -n '/{0x/ {s/^.*{0x\(*\).*/\1/p;q}' /tmp/resRA-$$` tag=`sed -n '/Tag=/... (5 Replies)
Discussion started by: Vitoriung
5 Replies

6. Shell Programming and Scripting

perl: a way to see a sub code in debug mode: perl -de 0 ?

Is there a way to see or print a sub code? Sometime a sub could be already defined, but in the debug mode (so, interactively) it could be already out of screen. So, I would think about a way to check if the sub is defined (just 'defined' is not a problem) and how it is defined. Also, if... (4 Replies)
Discussion started by: alex_5161
4 Replies

7. Shell Programming and Scripting

Debug script already running

Hello, is it possible to debug a script that is already running "on-demand"? Somehow a command like "set -x" but once you've executed the script. And another one to disable debugging? Thank you (0 Replies)
Discussion started by: asanchez
0 Replies

8. Shell Programming and Scripting

Logging perl and shell debug mode.

I have a shell program which calls a perl program. I am running the shell program with command; $ ksh -x <prog_name> Inside the shell program, I am calling perl with warnings. I want to capture the entire output as it comes on screen. The command I tried is: $ ksh -x... (1 Reply)
Discussion started by: som.nitk
1 Replies

9. Shell Programming and Scripting

Perl Debug Stepping Answering Questions

I am new to perl and want to get a little better understanding of debugging code in perl. I have a perl script that has questions to be answered like: he following PERL modules are recommended: Crypt::DES Crypt::PasswdMD5 IO::Pty Net::Write::Layer2 String::CRC32 Attempt to install... (0 Replies)
Discussion started by: metallica1973
0 Replies

10. Ubuntu

Debug script

How can I debug this script? I want to know what it is doing or not doing? #!/bin/bash # # if ; then # Do the thing you want before suspend here echo "we are suspending." > /tmp/systemd_suspend_test.txt elif ; then # Do the thing you want after resume here echo "and we are... (21 Replies)
Discussion started by: drew77
21 Replies
squid(8)                                                      System Manager's Manual                                                     squid(8)

NAME
squid - proxy caching server SYNOPSIS
squid [ -dhirsvzCDFINRVYX ] [ -l facility ] [ -f config-file ] [ -[ au ] port ] [ -k signal ] [ -n service-name ] [ -O cmd-line ] DESCRIPTION
squid is a high-performance proxy caching server for web clients, supporting FTP, gopher, and HTTP data objects. Unlike traditional caching software, squid handles all requests in a single, non-blocking, I/O-driven process. squid keeps meta data and especially hot objects cached in RAM, caches DNS lookups, supports non-blocking DNS lookups, and implements nega- tive caching of failed requests. squid supports SSL, extensive access controls, and full request logging. By using the lightweight Internet Cache Protocol, squid caches can be arranged in a hierarchy or mesh for additional bandwidth savings. squid consists of a main server program squid, a Domain Name System lookup program dnsserver, some optional programs for rewriting requests and performing authentication, and some management and client tools. When squid starts up, it spawns a configurable number of dnsserver processes, each of which can perform a single, blocking Domain Name System (DNS) lookup. This reduces the amount of time the cache waits for DNS lookups. squid is derived from the ARPA-funded Harvest Project http://harvest.cs.colorado.edu/ This manual page only lists the command line arguments. For details on how to configure squid see the file /etc/squid/squid.conf, the Squid FAQ and the documentation at the squid home page http://www.squid-cache.org OPTIONS
-d level Write debugging to stderr also. -f file Use the given config-file instead of /etc/squid/squid.conf -h Print help message. -i Install as a Windows Service (see -n option). -k reconfigure | rotate | shutdown | interrupt | kill | debug | check | parse Parse configuration file, then send signal to running copy (except -k parse) and exit. -n name Specify Windows Service name to use for service operations, default is: Squid -r Remove a Windows Service (see -n option). -s Enable logging to syslog. -l facility Use specified syslog facility. implies -s -u port Specify ICP port number (default: 3130), disable with 0. -v Print version. -z Create swap directories -C Do not catch fatal signals. -D Disable initial DNS tests. -F Don't serve any requests until store is rebuilt. -I Override first HTTP port with the bound socket passed in on standard input. -N No daemon mode. -O options Set Windows Service Command line options in Registry. -R Do not set REUSEADDR on port. -X Force full debugging. -Y Only return UDP_HIT or UDP_MISS_NOFETCH during fast reload. FILES
/etc/squid/squid.conf The main configuration file. You must initially make changes to this file for squid to work. For example, the default configura- tion does not allow access from any browser. /usr/share/doc/squid/examples/squid.conf Reference copy of the configuration file. Always kept up to date with the version of Squid you are using. Use this to look up con- figuration syntax after upgrading. /usr/share/squid/mime.conf (mime_table) MIME type mappings for FTP gatewaying /usr/share/squid/errors/en (error_directory) Error page templates SEE ALSO
cachemgr.cgi(8), ncsa_auth(8), pam_auth(8), squid_ldap_auth(8), squid_ldap_group(8), squid_session(8), squid_unix_group(8), The Squid FAQ Squid Web Proxy 2.7.STABLE9 2006-05-29 squid(8)
All times are GMT -4. The time now is 12:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy