Sponsored Content
Full Discussion: Extract IP from logs and
Top Forums Shell Programming and Scripting Extract IP from logs and Post 302778469 by Don Cragun on Monday 11th of March 2013 04:14:14 AM
Old 03-11-2013
So, just to be clear, what you want given the a.out in your example is for b.out to be an exact copy of a.out, and either there will be no c.out or c.out will be an empty file. Is that what you want? If that isn't what you want please explain in more detail what the output is supposed to be.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

logs

can i include this command into my crontab file > /var/adm/wtmp to clear the contents on a regular basis ? what about file permissions ? (6 Replies)
Discussion started by: cubicle^dweller
6 Replies

2. Shell Programming and Scripting

Logs

Hey Guys, i am new into shell programming and i have to do one script which have to record all the commands entered by a specific user. Example of that, i have a system running on unix, several users are using this system, i have to create like a databse which will record every user entered that... (5 Replies)
Discussion started by: charbel
5 Replies

3. UNIX for Advanced & Expert Users

logs

Hy, I have a question I have a directory in a unix server, Some of my files have a diffrent access time, from the time i accessed them last, I think some one has copied it,it's not an important file,but none the less,it is my file,It mistakenly had a 777 permission( yes ,I know it is a noob's... (1 Reply)
Discussion started by: lordmod
1 Replies

4. Shell Programming and Scripting

Grep yesterday logs from weblogic logs

Hi, I am trying to write a script which would go search and get the info from the logs based on yesterday timestamp and write yesterday logs in new file. The log file format is as follows: """"""""""""""""""""""""""... (3 Replies)
Discussion started by: harish.parker
3 Replies

5. Shell Programming and Scripting

Help needed to extract distinct logs from a Log File

Hi, I urgently need some help how to extract distinct entries from a Log file. The Log File may have same error occuring many times so how do i count the occurance of an error in file and also extract out distinct errors in a file. Eg:- I have a file name A.log it contains entries as below:-... (5 Replies)
Discussion started by: roro
5 Replies

6. Shell Programming and Scripting

Search for a pattern,extract value(s) from next line, extract lines having those extracted value(s)

I have hundreds of files to process. In each file I need to look for a pattern then extract value(s) from next line and then search for value(s) selected from point (2) in the same file at a specific position. HEADER ELECTRON TRANSPORT 18-MAR-98 1A7V TITLE CYTOCHROME... (7 Replies)
Discussion started by: AshwaniSharma09
7 Replies

7. Shell Programming and Scripting

Help with extract application logs through shell script in performance testing

Hi Experts, I am new to shell.How to extract logs (Web,APP,Database) using shell in performance testing? Need for webserver logs,app server logs and d/b logs code. Thanks in advance Sree (3 Replies)
Discussion started by: sree vasu
3 Replies

8. Shell Programming and Scripting

Perl script to extract last 24 hrs logs from cronlog

Hi Friends, Can anybody help me to create a perl script to generate log file for last 24 hrs from cron log file ?? Thank You (2 Replies)
Discussion started by: syamji.vm
2 Replies

9. Shell Programming and Scripting

How to extract logs between the current time and the last 15 minutes ?

I want to extract the logs between the current time stamp and 15 minutes before and sent an email to the people configured. I developed the below script but it's not working properly; can someone help me?? I have a log file containing this pattern: Constructor QuartzJob ... (3 Replies)
Discussion started by: puneetkhullar
3 Replies

10. Shell Programming and Scripting

If I ran perl script again,old logs should move with today date and new logs should generate.

Appreciate help for the below issue. Im using below code.....I dont want to attach the logs when I ran the perl twice...I just want to take backup with today date and generate new logs...What I need to do for the below scirpt.............. 1)if logs exist it should move the logs with extention... (1 Reply)
Discussion started by: Sanjeev G
1 Replies
dpm2_python(3)							 Python Reference						    dpm2_python(3)

NAME
dpm - Python interface to the DPM SYNOPSIS
import dpm2 as 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. FUNCTIONS
dpns_aborttrans ( ) dpns_access ( string path, int amode ) -> bool access dpns_accessr ( string sfn, int amode ) -> bool access dpns_addreplica ( string guid, struct dpns_fileid *file_uniqueid, string server, string sfn, char status, char f_type, string poolname, string fs ) dpns_addreplicax ( string guid, struct dpns_fileid *file_uniqueid, string server, string sfn, char status, char f_type, string poolname, string fs, char r_type, string setname ) dpns_chdir ( string path ) dpns_chmod ( string path, mode_t mode ) dpns_chown ( string path, uid_t new_uid, gid_t new_gid ) dpns_client_setAuthorizationId ( uid_t uid, gid_t gid, string mech, string id ) dpns_client_setVOMS_data ( string voname, stringlist vomsdata ) dpns_closedir ( dpns_DIR dirp ) dpns_creat ( string path, mode_t mode ) dpns_delcomment ( string path ) dpns_delete ( string path ) dpns_delreplica ( string guid, struct dpns_fileid *file_uniqueid, string sfn ) dpns_delreplicasbysfn ( ListOfString sfns, ListOfString guids ) -> ListOfInt results dpns_endsess ( ) dpns_endtrans ( ) dpns_getacl ( string path, ) -> ListOf struct dpns_acl acls dpns_getcomment ( string path ) -> string comment dpns_getcwd ( ) -> string dir dpns_getifcevers ( ) -> string version dpns_getlinks ( string path, string guid ) -> ListOf struct dpns_linkinfo links dpns_getreplica ( string path, string guid, string se ) -> ListOf struct dpns_filereplica replicas dpns_getreplicax ( string path, string guid, string se ) -> ListOf struct dpns_filereplicax replicas dpns_lchown ( string path, uid_t new_uid, gid_t new_gid ) dpns_listreplicax ( string poolname, string server, string fs, int flags, dpns_list * listp ) -> struct dpns_filereplica replica dpns_listrepset ( string setname, int flags, dpns_list *listp ) -> struct dpns_filereplicax replica dpns_lstat ( string path ) -> struct dpns_filestat statbuf dpns_mkdir ( string path, mode_t mode ) dpns_modreplica ( string sfn, string setname, string poolname, string server ) dpns_modreplicax ( string sfn, string setname, string poolname, string server, string fs, char r_type ) dpns_opendir ( string path ) -> dpns_DIR dir dpns_opendirxg ( string server, string path, string guid ) -> dpns_DIR dir dpns_ping ( string server ) -> string info dpns_readdir ( dpns_DIR dirp ) -> struct dirent dirent dpns_readdirc ( dpns_DIR dirp ) -> struct dpns_direncomm dirent dpns_readdirg ( dpns_DIR dirp ) -> struct dpns_direnstatg dirent dpns_readdirx ( dpns_DIR dirp ) -> struct dpns_direnstat dirent dpns_readdirxc ( dpns_DIR dirp ) -> struct dpns_direnstatc dirent dpns_readdirxp ( dpns_DIR dirp, string pattern, string se = None ) -> struct dpns_direnrep dirent dpns_readdirxr ( dpns_DIR dirp, string se = None ) -> struct dpns_direnrep dirent dpns_readlink ( string path ) -> string link dpns_rename ( string oldpath, string newpath ) dpns_rewinddir ( dpns_DIR dirp ) dpns_rmdir ( string path ) dpns_setacl ( string path, ListOf struct dpns_acl acls ) dpns_setatime ( string path, struct dpns_fileid file_uniqueid ) dpns_setcomment ( string path, string comment ) dpns_setfsize ( string path, struct dpns_fileid file_uniqueid, long filesize ) dpns_setfsizec ( string path, struct dpns_fileid file_uniqueid, long filesize, string csumtype, string csumvalue ) dpns_setptime ( string sfn, long ptime ) dpns_setratime ( string sfn ) dpns_setrltime ( string sfn, long ltime ) dpns_setrstatus ( string sfn, char status ) dpns_setrtype ( string sfn, char type ) dpns_startsess ( string server, string comment ) dpns_starttrans ( string server, string comment ) dpns_stat ( string path ) -> struct dpns_filestat statbuf dpns_statg ( string path, string guid ) -> struct dpns_filestatg statbuf dpns_statr ( string sfn) ) -> struct dpns_filestatg statbuf dpns_symlink ( string target, string linkname ) dpns_umask ( mode_t cmask ) -> mode_t oldmask dpns_undelete ( string path ) dpns_unlink ( string path ) dpns_utime ( string path, struct utimbuf times ) dpns_entergrpmap ( gid_t gid, string groupname ) dpns_enterusrmap ( uid_t uid, string username ) dpns_getgrpbygid ( gid_t gid ) -> string group dpns_getgrpbygids ( ListOfgid_t gids ) -> ListOfString groups dpns_getgrpbynam ( string groupname ) -> gid_t gid dpns_getgrpmap ( ) -> ListOf struct dpns_groupinfo infos dpns_getusrbynam ( string username ) -> uid_t uid dpns_getusrbyuid ( uid_t uid ) -> string user dpns_getusrmap ( ) -> ListOf struct dpns_userinfo userinfo dpns_modifygrpmap ( gid_t gid, string newname ) dpns_modifyusrmap ( uid_t uid, string newname ) dpns_rmgrpmap ( gid_t gid, string groupname ) dpns_rmusrmap ( uid_t uid, string username ) dpm_getpoolfs ( string poolname ) -> ListOf struct dpm_fs dpm_fs dpm_getpools ( ) -> ListOf struct dpm_pool dpm_pools dpm_getprotocols ( ) -> ListOfString protocols dpm_getspacemd ( ListOfString s_tokens ) -> ListOf struct dpm_space_metadata spacemd dpm_getspacetoken ( string u_token ) -> ListOfString s_tokens dpm_addfs ( string poolname, string server, string fs, int status ) dpm_addpool ( struct dpm_pool dpm_pool ) dpm_delreplica ( string pfn ) dpm_modifyfs ( string server, string fs, int status ) dpm_modifypool ( struct dpm_pool dpm_pool ) dpm_ping ( string host ) -> string info dpm_releasespace ( string s_token, int force ) dpm_reservespace ( char s_type, string u_token, char ret_policy, char ac_latency, long req_t_space, long req_g_space, long req_lifetime, ListOfInt gids, string poolname ) -> char actual_s_type, long actual_t_space, long actual_g_space, long actual_lifetime, string s_token dpm_rmfs ( string server, string fs ) dpm_rmpool ( string poolname ) dpm_updatespace ( string s_token, long req_t_space, long req_g_space, long req_lifetime, ListOfInt gids ) -> long actual_t_space, long actual_g_space, long actual_lifetime STRUCTURES
Sometimes you need to specify a structure as an input argument (eg. struct dpns_acl, struct dpns_list, struct dpm_pool, etc.). For that purpose, the module includes structure constructors, named exactly as the structure. Thus, to create struct dpns_acl, struct dpns_list or struct dpmm_pool, you have to do the following: dpnsacl = dpm.dpns_acl() dpnslist = dpm.dpns_list() dpmpool = dpm.dpm_pool() If you want to see how to use it in a real case, please have a look at examples. ERRORS
As you can see, no error code is returned. When an error occurs, an exception is raised with a description of the error. EXAMPLE
#!/usr/bin/python """ # Using the dpns_readdirxr method """ import sys import traceback import dpm2 as dpm name = "/dpm/cern.ch/home/dteam/"; try: dir = dpm.dpns_opendir(name) while 1: entry = dpm.dpns_readdirxr(dir) if entry == None: break print entry.d_name for i in range(entry.nbreplicas): print " ==> %s" % entry.rep[i].sfn dpm.dpns_closedir(dir) except TypeError, x: print " ==> None" except Exception: traceback.print_exc() sys.exit(1) EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpns_getreplica method """ file = "/dpm/cern.ch/home/dteam/file.test" try: list = dpm.dpns_getreplica(file, "", "") except Exception: traceback.print_exc() sys.exit(1) for i in list: print i.host print i.sfn EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpns_getacl and dpns_setacl methods to add a user ACL """ file = "/dpm/cern.ch/home/dteam/file.test" try: acls_list = dpm.dpns_getacl(file) except Exception: traceback.print_exc() sys.exit(1) 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 = lfc.CNS_ACL_USER acl_user.a_id = 18701 # user id acl_user.a_perm = 5 acl_mask.a_type = lfc.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) try: dpm.dpns_setacl(file, acls_list) except Exception: traceback.print_exc() sys.exit(1) EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpns_getacl and dpns_setacl methods to remove a user ACL """ file = "/dpm/cern.ch/home/dteam/file.test" try: acls_list = dpm.dpns_getacl(file) except Exception: traceback.print_exc() sys.exit(1) 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 try: dpm.dpns_setacl(file, acls_list) except Exception: traceback.print_exc() sys.exit(1) EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpns_getusrmap method """ try: list = dpm.dpns_getusrmap() except Exception: traceback.print_exc() sys.exit(1) for i in list: print i.userid + " " + i.username EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpns_getgrpmap method """ try: list = dpm.dpns_getgrpmap() except Exception: traceback.print_exc() sys.exit(1) for i in list: print i.gid + " " + i.groupname EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpm_addfs method """ try: dpm.dpm_addfs("mypool", "mydiskserver.domain.com", "/mountpoint", dpm.FS_READONLY) except Exception: traceback.print_exc() sys.exit(1) EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpm_modifyfs method """ try: dpm.dpm_modifyfs("mydiskserver.domain.com", "/mountpoint", dpm.FS_READONLY) except Exception: traceback.print_exc() sys.exit(1) EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpm_rmfs method """ try: dpm.dpm_rmfs("mypool", "mydiskserver.domain.com", "/mountpoint") except Exception: traceback.print_exc() sys.exit(1) EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as 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' try: dpm.dpm_addpool(dpmpool) except Exception: traceback.print_exc() sys.exit(1) EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as 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' try: dpm.dpm_modifypool(dpmpool) except Exception: traceback.print_exc() sys.exit(1) EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpm_rmpool method """ try: dpm.dpm_rmpool("mypool") except Exception: traceback.print_exc() sys.exit(1) EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpm_getpoolfs method """ try: list = dpm.dpm_getpoolfs("mypool") except Exception: traceback.print_exc() sys.exit(1) print len(list) 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 sys import traceback import dpm2 as dpm """ # Using the dpm_getpools method """ try: list = dpm.dpm_getpools() except Exception: traceback.print_exc() sys.exit(1) print len(list) for i in list: print "POOL " + i.poolname + " CAPACITY " + i.capacity + " FREE " + i.free EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpm_getprotocols method """ try: list = dpm.dpm_getprotocols() except Exception: traceback.print_exc() sys.exit(1) print len(list) for i in list: print i EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpm_getspacemd method """ try: list = dpm.dpm_getspacemd(["myspacetoken"]) except Exception: traceback.print_exc() sys.exit(1) print len(list) 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 sys import traceback import dpm2 as dpm """ # Using the dpm_getspacetoken method """ try: list = dpm.dpm_getspacetoken("myspacetokendesc") except Exception: traceback.print_exc() sys.exit(1) print len(list) for i in list: print i EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpm_reservespace method """ try: 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") except Exception: traceback.print_exc() sys.exit(1) print "TYPE " + actual_s_type + " TOTAL " + actual_t_space + " GUARANTEED " + actual_g_space + " LIFETIME " + actual_lifetime + " TOKEN " + s_token EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpm_updatespace method """ try: actual_t_space,actual_g_space,actual_lifetime = dpm.dpm_updatespace("myspacetoken", 209715200, 209715200, 2592000) except Exception: traceback.print_exc() sys.exit(1) print " TOTAL " + actual_t_space + " GUARANTEED " + actual_g_space + " LIFETIME " + actual_lifetime EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpm_releasespace method """ try: dpm.dpm_releasespace("myspacetoken", 0) except Exception: traceback.print_exc() sys.exit(1) EXAMPLE
#!/usr/bin/python import sys import traceback import dpm2 as dpm """ # Using the dpm_ping method """ try: info = dpm.dpm_ping("mydpmserver.domain.com") except Exception: traceback.print_exc() sys.exit(1) print info SEE ALSO
DPM C interface man pages DPM
$Date: 2010-12-14 08:31:05 +0100 (Tue, 14 Dec 2010) $ dpm2_python(3)
All times are GMT -4. The time now is 08:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy