Sponsored Content
Top Forums Shell Programming and Scripting first script. need help and advice. Post 302091784 by sanchopansa on Thursday 5th of October 2006 06:39:07 AM
Old 10-05-2006
Thanks very much, vish_indian.
I looked through the man page after you posted your first reply but I couldn't find what I needed. You were right that it lists the ports and now everything is fine with this.
What I am confused now with is that I want for everyone of the processes that are listed with lsof -i -P to make a list of all the files that each one is using. I looked at the reference and it's done with lsof -p PID, but is there a way to incorporate these two commands into one so that it lists the processes and the files without having to manually run the lsof -p command for each process separately.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

c-shell script advice please.

Hi, I have the following script running in my cron. -------------------------------------------------------------------- #!/bin/csh bnstat -p GPD_VSLinux | grep pg | grep varcon | awk '{print $1, $2, $3, $4, $5, $6, $7, $8, $9, $10}' > /tmp/LX_xbatch.log bnstat -p GPD_VSLinux_test | grep pg... (2 Replies)
Discussion started by: killerserv
2 Replies

2. Shell Programming and Scripting

Advice on Script

I would like some advice on how to logically put together a script to handle a daily task of data gathering for the following problem. I have two files, file1 has 125,000 records that I cut and remove unwanted fields through scripts and cron. In file2, I have 25000 records that has the same... (4 Replies)
Discussion started by: greengrass
4 Replies

3. Shell Programming and Scripting

Script Advice please?

Ok. I want to parse a log file and search only for denied traffic for the previous hour. The log looks like this: Jun 18 17:47:56 routername 36806: Jun 18 17:53:01.088: %SEC-6-IPACCESSLOG: list ingress-filter denied tcp 1.2.3.4(1234) -> 6.7.8.9(53), 4 packets I only really care about the... (12 Replies)
Discussion started by: earnstaf
12 Replies

4. Shell Programming and Scripting

Script Help/Advice

Alright, I feel like I have a pretty good basic knowledge of shell scripting, but this one is throwing me for a loop. I know I've seen something similar done with awk, but I couldn't find it with the search function. I've grepped through my log file and get results like this: --... (14 Replies)
Discussion started by: earnstaf
14 Replies

5. Shell Programming and Scripting

advice on shell script

Hello, I have this script running on cron every 20 minutes. By 12pm daily, our system is expecting all input files to be uploaded by the script. After this cutoff time, the script would still be running though, but i need some kind of alerts/logs to know which input files weren't received for... (1 Reply)
Discussion started by: gholdbhurg
1 Replies

6. Shell Programming and Scripting

Looking for optimization advice on a short script

I already have a solution to my problem, but I'm looking to see if it can be made more succinct and faster. The problem: given a list, as shown below, extract the pathname for any file in a directory named 'ample' and return it's index into the list. The index is also in the data itself. Note that... (1 Reply)
Discussion started by: prigo
1 Replies

7. Shell Programming and Scripting

Advice on script

Hi folks, I use following script:- #!/bin/sh # cd Linbread TODAY=`date +"%m%d"` DATA=`grep $TODAY linbread.dat` HOUR=`date +"%H"` if then TOD="Morning" elif then TOD="Afternoon" else TOD="Evening" fi echo $DATA | gawk -F"|" '{printf("%s\n\n%s",$2,$3)}' > $$tmp fold -s -w60... (0 Replies)
Discussion started by: satimis
0 Replies

8. Shell Programming and Scripting

Need advice on approach for script

Greetings all. I have a repository server which receives, without exhaggeration, several million files a week. The majority of these files are in .csv format, which means they're highly compressable. They are spread throughout numerous directories where there are configured monitoring utilities... (4 Replies)
Discussion started by: msarro
4 Replies

9. Shell Programming and Scripting

Script advice

All I have 2 parent directories - input and output. Each parent has multiple sub-directories...each sub-directory has multiple files. Each parent directory structure is a mirror image of itself I need to poll the imput directory and if a new file is found, encrypt the file, move the file to... (2 Replies)
Discussion started by: davidra
2 Replies

10. UNIX for Advanced & Expert Users

Advice on a backup script, maybe one is out there already?

Hi, Not sure whether this is the right place to post it. I decided to post it here 'coz Advanced and Expert users will most likely have the answer to what I am looking for. I want to backup scripts that I have access to to a tar file file and zip it. At the moment I am creating a directory... (4 Replies)
Discussion started by: newbie_01
4 Replies
checkrestart(1) 						  debian-goodies						   checkrestart(1)

NAME
checkrestart - check which processes need to be restarted after an upgrade SYNOPSIS
checkrestart [ -hvpa ] [ -b blacklist_file ] [ -i package_name ] DESCRIPTION
The checkrestart program tries to determine if there are processes in the system that need to be restarted after a system upgrade. This is necessary since an upgrade will usually bring new system libraries and running processes will be still using the old versions of the libraries. In stable Debian GNU/Linux systems this is typically needed to eliminate a system exposure to a vulnerability which might have been fixed by upgrading a library which that process makes use of. Consequently, checkrestart is sometimes used as an audit tool to find outdated versions of libraries in use, particularly after security upgrades. Administrators should not, however, rely on its output completely (see BUGS below). This script needs to run as root in order to obtain the information it needs for analysis. OPTIONS
-h,--help Show the program help and exit. -v,--verbose Generate detailed output. This output includes the list of all processes found using deleted files or descriptors as well as the deleted files and descriptors found. -p,--package Only process deleted files that belong to a package, ignoring deleted files which do not have an associated package in the package system. -a,--all Process all deleted files regardless of location. This makes the program analyse deleted files even if they would be discarded because they are located in locations, such as /tmp , which are known to produce false positives. It will take preceded if used simultaneously with the -p option. -b file,--blacklist=file Read a blacklist of regular expressions from file. Any files matching the patterns will be ignored. -i name,--ignore=name Ignore services that are associated to the package name provided in name. EXIT STATUS
The program will exit with error (1) if a non-root user tries to run it. Otherwise, it will always exit with error status 0. BUGS
This program might fail if the output of the lsof utility changes since it depends on it to detect which deleted files are used by pro- cesses. It might also output some false positives depending on the processes' behaviour since it does not check yet if the (deleted) files in use are really libraries. If you find a false positive in checkrestart please provide the following information when submitting a bug report: -- The output of checkrestart using the -v (verbose) option. -- The output of running the following command as root: lsof | egrep 'delete|DEL|path inode' Checkrestart is also sensitive to the kernel version in use. And might fail to work with newer (or older) versions. A rewrite to make it less dependent on lsof could improve this, however. SEE ALSO
lsof(8) AUTHOR
checkrestart was written by Matt Zimmerman for the Debian GNU/Linux distribution. COPYRIGHT AND LICENCE
Copyright (C) 2001 Matt Zimmerman <mdz@debian.org> Copyright (C) 2007,2010-2011 Javier Fernandez-Sanguino <jfs@debian.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. On Debian systems, a copy of the GNU General Public License may be found in /usr/share/common-licenses/GPL. debian-goodies December 19 2006 checkrestart(1)
All times are GMT -4. The time now is 05:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy