[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

two new scripts in ~radmind/bin



Willie and I have put two somewhat useful scripts inside ~radmind/bin.

The script I wrote is called "locks", and it will let you know which files are currently checked out of rcs. It takes directories to check as arguments, and if no arguments are given it works on the current working directory.

for example:

sixthday-radmind:; pwd
/var/radmind/transcript/rsug
sixthday-radmind:; locks
/var/radmind/transcript/rsug
-rw-r--r--   1 radmind  blackops     525 Jun 21 16:20 virus-scan.T
locks: strict
        sweda: 1.8

you can combine this with grep to see what you have checked out:

sixthday-radmind:; locks ~/transcript ~/command ~/transcript/rsug ~/ command/rsug | grep -B2 sweda
-rw-r--r-- 1 radmind blackops 847 Jun 4 03:26 lfs-imap-neg.T
locks: strict
sweda: 1.4
--
-rw-r--r-- 1 radmind blackops 469 Mar 7 17:41 lfs-dir- godfather.K
locks: strict
sweda: 1.22
--
-rw-r--r-- 1 radmind blackops 687 Jun 4 03:55 lfs-imap- frankenstein.K
locks: strict
sweda: 1.4
--
-rw-r--r-- 1 radmind blackops 525 Jun 21 16:20 virus-scan.T
locks: strict
sweda: 1.8



The second script was written by Willie, and is called "parents". Here is his description:



Begin forwarded message:


The radmind "parents" script takes a list of a mixture of either transcripts, or command files and returns the machine names that depend on those.

parents transcript-or-directory-name [additional-T-or-K]

The parents script will recursively do a recursive grep in the command directory looking for command files that are using your object. For example, if a transcript is being used by a command file, then the script does another recursive grep for that command file until no more results are found. Any machines that are listed as using any of those command files in the config file are listed at the end.

If the object you're looking for ends in .T (or .t) it will look in the ~/transcript/ directory. If it ends with .K (or .k) - it looks in the ~/command/ directory. If it's not there (but could be in a sub-directory), it complains with an error.

Everyone should be able to read the perl script, which is located in /var/radmind/bin/parents - let me know if you'd like to contribute any changes.

- Willie

Examples:

# which machines are using my transcript?

sixthday-radmind:; parents lfs-umweb-mysql-mail.T
oriya.web.itd.umich.edu
fanakalo.web.itd.umich.edu
punjabi.web.itd.umich.edu

# which machines are using my command file?
# this example isn't a full-machine command file, but instead transcripts packaged together for dependencies


sixthday-radmind:; parents umweb/rrdtool.K
oriya.web.itd.umich.edu
fanakalo.web.itd.umich.edu
bengali.web.itd.umich.edu
urdu.web.itd.umich.edu
punjabi.web.itd.umich.edu
hindi.mail.umich.edu
kashmiri.mail.umich.edu
sindhi.mail.umich.edu

# commands can be strung together to get more powerful combos:
# who are this machine's siblings?

sixthday-radmind:; parents `grep oriya config | awk '{print $2}'`
oriya.web.itd.umich.edu
fanakalo.web.itd.umich.edu
punjabi.web.itd.umich.edu

# find all machines that have a mysql client loaded...
sixthday-radmind:; parents `find transcript/ -name "*mysql*" | grep -i client | grep -v OLD | grep -v RCS | cut -c 12-`
area51.rsug.itd.umich.edu
whitesands.rsug.itd.umich.edu
javanese.web.itd.umich.edu
serbian.web.itd.umich.edu
... etc ...