Sponsored Content
Full Discussion: Checking Web Pages?
Top Forums Shell Programming and Scripting Checking Web Pages? Post 302477451 by research3 on Sunday 5th of December 2010 07:47:37 AM
Old 12-05-2010
w3m or you can use the follow python script:

Code:
#!/usr/bin/python
from urllib import urlopen
doc = urlopen("http://www.python.org").read()
print doc

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Dynamic web pages for Unix Web Server

Hi, my company is considering a new development of our web site, which used to run on Apachi over Solaris. The company who is going to do this for us knows only about developing it in ASP. I guess this means we'll have to have another ISS server on NT for these dynamic pages :( What are... (5 Replies)
Discussion started by: me2unix
5 Replies

2. Shell Programming and Scripting

Count links in all of my web pages

Counts the number of hyperlinks in all web pages in the current directory and all of its sub-directories. Count in all files of type "*htm" and "*html" . i want the output to look something like this: Total number of web pages: (number) Total number of links: (number) Average number of links... (1 Reply)
Discussion started by: phillip
1 Replies

3. UNIX for Dummies Questions & Answers

Selecting information from several web pages...

Hi All! Is this possible? I know of several hundreds of urls linking to similar looking hp-ux man pages, like these. In these urls only the last words separated by / are changing in numbering, so we can generate these... http://docs.hp.com/hpux/onlinedocs/B3921-90010/00/00/31-con.html... (2 Replies)
Discussion started by: Vishnu
2 Replies

4. Shell Programming and Scripting

Checking availability of Web pages through Unix script

Hi Guru's, I need to check the availability of a web page for every one hour through a script. Following is the requirement. 1. Go to http://vsn.srivsn.com 2. If any error encountered in openeing the home page, it should trigger an email with the appropriate error message. 3. If page opens... (6 Replies)
Discussion started by: srivsn
6 Replies

5. Shell Programming and Scripting

Investigating web pages in awk

hello. i want to make an awk script to search an html file and output all the links (e.g .html, .htm, .jpg, .doc, .pdf, etc..) inside it. also, i want the links that will be output to be split into 3 groups (separated by an empty line), the first group with links to other webpages (.html .htm etc),... (1 Reply)
Discussion started by: adpe
1 Replies

6. UNIX for Dummies Questions & Answers

curl command with web pages

I can't quite seem to understand what the curl command does with a web address. I tried this: curl O'Reilly Media: Tech Books, Conferences, Courses, News but I just got the first few lines of a web page, and it's nowhere on my machine. Can someone elaborate? (2 Replies)
Discussion started by: Straitsfan
2 Replies

7. UNIX for Dummies Questions & Answers

Forcing web pages to anti-aliase

Here is an observation that has started to riddle me and perhaps someone can enlighten me. When a web page (or desktop page for that matter) uses the standard font, it is not anti-aliased, unless the user opts in to do so via the desktop settings. It appears however that fonts are not... (0 Replies)
Discussion started by: figaro
0 Replies

8. Shell Programming and Scripting

Get web pages and compare

Hello, I'm writing a shell script to wget content web pages from multiple server into a variable and compare if they match return 0 or return 2 #!/bin/bash # Cluster 1 CLUSTER1_SERVERS="srv1 srv2 srv3 srv4" CLUSTER1_APPLIS="test/version.html test2.version.jsp" # Liste des... (4 Replies)
Discussion started by: gtam
4 Replies

9. Shell Programming and Scripting

Get web pages and compare

Hello I'm writing a script to get content of web pages on different machines and compare them using their md5 hash hear is my code #!/bin/bash # Cluster 1 CLUSTER1_SERVERS="srv01:7051 srv02:7052 srv03:7053 srv04:7054" CLUSTER1_APPLIS="test/version.html test2/version.html... (2 Replies)
Discussion started by: gtam
2 Replies
dpm_python(3)							 Python Reference						     dpm_python(3)

NAME
dpm - Python interface to the DPM SYNOPSIS
import dpm DESCRIPTION
The dpm module permits you to access the DPM client interface from python programs. The dpm module is a swig wrapping of the standard C interface. For detailed descriptions of each function see the individual man page of each function. There follows a series of examples of how to use selected functions and how to retrieve the information returned by them: Examples are listing the replicas of a given entry, reading the content of a directory, getting and setting ACLs. etc. EXAMPLE
#!/usr/bin/python """ # Using the dpns_readdirxr method """ import sys import dpm name = "/dpm/cern.ch/home/dteam/"; dir = dpm.dpns_opendirg(name,"") if (dir == None) or (dir == 0): err_num = dpm.cvar.serrno err_string = dpm.sstrerror(err_num) print "Error while looking for " + name + ": Error " + str(err_num) + " (" + err_string + ")" sys.exit(1) while 1: read_pt = dpm.dpns_readdirxr(dir,"") if (read_pt == None) or (read_pt == 0): break entry, list = read_pt print entry.d_name try: for i in range(len(list)): print " ==> %s" % list[i].sfn except TypeError, x: print " ==> None" dpm.dpns_closedir(dir) EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpns_getlinks method """ result, list = dpm.dpns_getlinks("/dpm/cern.ch/home/dteam/file.test", "") print result print len(list) if (result == 0): for i in list: print i.path EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpns_getreplica method """ result, list = dpm.dpns_getreplica("/dpm/cern.ch/home/dteam/file.test", "", "") print result print len(list) if (result == 0): for i in list: print i.host print i.sfn EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpns_getacl and dpns_setacl methods to add a user ACL """ nentries, acls_list = dpm.dpns_getacl("/dpm/cern.ch/home/dteam/file.test", dpm.CA_MAXACLENTRIES) print nentries print len(acls_list) for i in acls_list: print i.a_type print i.a_id print i.a_perm # When adding a first ACL for a given user, you also need to add the mask # When adding the second user ACL, it is not necessary anymore acl_user = dpm.dpns_acl() acl_mask = dpm.dpns_acl() acl_user.a_type=2 # 2 corresponds to CNS_ACL_USER acl_user.a_id=18701 # user id acl_user.a_perm=5 acl_mask.a_type=5 # 5 corresponds to CNS_ACL_MASK acl_mask.a_id=0 # no user id specified acl_mask.a_perm=5 acls_list.append(acl_user) acls_list.append(acl_mask) res = dpm.dpns_setacl("/dpm/cern.ch/home/dteam/file.test", acls_list) if res == 0: print "OK" else: err_num = dpm.cvar.serrno err_string = dpm.sstrerror(err_num) print "There was an error : Error " + str(err_num) + " (" + err_string + ")" sys.exit(1) EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpns_getacl and dpns_setacl methods to remove a user ACL """ nentries, acls_list = dpm.dpns_getacl("/dpm/cern.ch/home/dteam/file.test", dpm.CA_MAXACLENTRIES) # Note : you cannot remove the owner ACL (i.e. for CNS_ACL_USER_OBJ type) if # ====== ACLs for other users exist. If all the other user ACLs are deleted, # ====== the owner ACL is automatically removed. for i in acls_list: print i.a_type print i.a_id print i.a_perm del acls_list[1] # delete a given user ACL from the list of ACLs res = dpm.dpns_setacl("/dpm/cern.ch/home/dteam/file.test", acls_list) if res == 0: print "OK" else: err_num = dpm.cvar.serrno err_string = dpm.sstrerror(err_num) print "There was an error : Error " + str(err_num) + " (" + err_string + ")" sys.exit(1) EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpns_getusrmap method """ result, list = dpm.dpns_getusrmap() print result print len(list) if (result == 0): for i in list: print i.userid + " " + i.username EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpns_getgrpmap method """ result, list = dpm.dpns_getgrpmap() print result print len(list) if (result == 0): for i in list: print i.gid + " " + i.groupname EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_addfs method """ result = dpm.dpm_addfs("mypool", "mydiskserver.domain.com", "/mountpoint", dpm.FS_READONLY) print result EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_modifyfs method """ result = dpm.dpm_modifyfs("mydiskserver.domain.com", "/mountpoint", dpm.FS_READONLY) print result EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_rmfs method """ result = dpm.dpm_rmfs("mypool", "mydiskserver.domain.com", "/mountpoint") print result EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_addpool method """ dpmpool = dpm.dpm_pool() dpmpool.poolname = "mypool" dpmpool.defsize = 209715200 dpmpool.def_lifetime = 604800 dpmpool.defpintime = 604800 dpmpool.max_lifetime = 604800 dpmpool.max_pintime = 604800 dpmpool.nbgids = 1 dpmpool.gids = [0] dpmpool.ret_policy = 'R' dpmpool.s_type = 'D' result = dpm.dpm_addpool(dpmpool) print result EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_modifypool method """ dpmpool = dpm.dpm_pool() dpmpool.poolname = "mypool" dpmpool.defsize = 209715200 dpmpool.def_lifetime = 604800 dpmpool.defpintime = 604800 dpmpool.max_lifetime = 604800 dpmpool.max_pintime = 604800 dpmpool.nbgids = 1 dpmpool.gids = [0] dpmpool.ret_policy = 'R' dpmpool.s_type = 'D' result = dpm.dpm_modifypool(dpmpool) print result EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_rmpool method """ result = dpm.dpm_rmpool("mypool") print result EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_getpoolfs method """ result,list = dpm.dpm_getpoolfs("mypool") print result print len(list) if (result == 0): for i in list: print "POOL " + i.poolname + " SERVER " + i.server + " FS " + i.fs + " CAPACITY " + i.capacity + " FREE " + i.free EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_getpools method """ result,list = dpm.dpm_getpools() print result print len(list) if (result == 0): for i in list: print "POOL " + i.poolname + " CAPACITY " + i.capacity + " FREE " + i.free EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_getprotocols method """ result,list = dpm.dpm_getprotocols() print result print len(list) if (result == 0): for i in list: print i EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_getspacemd method """ result, list = dpm.dpm_getspacemd(["myspacetoken"]) print result print len(list) if (result == 0): for i in list: print "TYPE " + i.s_type + " SPACETOKEN " i.s_token + " USERTOKEN " + i.u_token + " TOTAL " + i.t_space + " GUARANTUEED " + i.g_space + " UNUSED " + i.u_space + " POOL " + i.poolname EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_getspacetoken method """ result, list = dpm.dpm_getspacetoken("myspacetokendesc") print result print len(list) if (result == 0): for i in list: print i EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_reservespace method """ result,actual_s_type,actual_t_space,actual_g_space,actual_lifetime,s_token = dpm.dpm_reservespace('D', "myspacetokendesc", 'R', 'O', 209715200, 209715200, 2592000, 0, "mypoolname") print result if (result == 0): print "TYPE " + actual_s_type + " TOTAL " + actual_t_space + " GUARANTEED " + actual_g_space + " LIFETIME " + actual_lifetime + " TOKEN " + s_token EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_updatespace method """ result,actual_t_space,actual_g_space,actual_lifetime = dpm.dpm_updatespace("myspacetoken", 209715200, 209715200, 2592000) print result if (result == 0): print " TOTAL " + actual_t_space + " GUARANTEED " + actual_g_space + " LIFETIME " + actual_lifetime EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_releasespace method """ result = dpm.dpm_releasespace("myspacetoken", 0) print result EXAMPLE
#!/usr/bin/python import dpm """ # Using the dpm_ping method """ result,info = dpm.dpm_ping("mydpmserver.domain.com") print result if (result == 0): print info KNOWN BUGS
The current interface to the dpns_getcwd(3), dpns_readlink(3), dpns_seterrbuf(3) requires the passing of str object which is modified to contain the result (in a similar way to the C functions, which accept a buffer). However this breaks the immutability of python str. This will be changed in the future. SEE ALSO
DPM C interface man pages DPM
$Date: 2010-02-04 13:08:39 +0100 (Thu, 04 Feb 2010) $ dpm_python(3)
All times are GMT -4. The time now is 08:28 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy