Sponsored Content
Top Forums Shell Programming and Scripting Need to create a simple script using MD5, SSH... Post 302502693 by Corona688 on Tuesday 8th of March 2011 03:52:39 PM
Old 03-08-2011
Well, if it's printing "ssh-ing to box rtidsva", it must be pulling that name from somewhere, so I think it really is executing those two programs and reading the names appropriately.

I assume this 'first' variable is to compare all following with the local host. Why not do that separately to avoid confusion and cut a big chunk of extra logic out?

Code:
#!/usr/bin/sh 
 
while read fname; do 
    bname=$(basename $fname) 
    echo "trying "${fname} (${bname})" >&2

    hash=$(/usr/local/bin/md5 /opt/dba/scp/$bname | awk '{print $4}')

    echo "local hash is ${hash}"

    /usr/local/bin/hosts | while read box ; do 
        echo "ssh-ing to box ${box}" >&2
        t=$(ssh ${box} "/usr/local/bin/md5 /opt/dba/scp/$bname" | awk '{print $4}') 
        echo "comparing ${hash} to ${t}" >&2
        [ "${hash}" = "${t}" ] || echo "Files are not Identical!!!"
    done 
done < /home/izivanov/iz3

When in doubt, print everything. Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to create md5 Hash variable?

I have a script that runs the grub-md5-crypt command based on whether the pass_value variable is a non-zero string. The md5 hash is being created in the /opt/hostconfigs/$HOST file, but I can't echo $md5_value. It is blank. Is there a way to create and echo a md5 hash variable? if then... (1 Reply)
Discussion started by: cstovall
1 Replies

2. Shell Programming and Scripting

Modifying simple commands to create a script

Can anyone direct me to a resource that explains scripting in simple terms? I have visited many sites and browsed this forum and have yet to find simple explanations. (8 Replies)
Discussion started by: rocinante
8 Replies

3. Shell Programming and Scripting

Simple Script to create folders

Hi I want to write a small script that will create folders named from `AAAA' all the way to `ZZZZ'. That is: `AAAA' `AAAB' `AAAC' ... `AABA' `AABB' `AABC' ... `ABAA' `ABAB' `ABAC' ... `ABBA' ... `ZZZZ' (4 Replies)
Discussion started by: ksk
4 Replies

4. Shell Programming and Scripting

Simple SSH script

I have several unix servers, I need to logon to each server and find out if an id exists on that server. I need a simple script for this, i have come up with the following script, but I cannot bring the output of a child process on the remote server. for i in `cat SERVER_LIST` do ssh $i... (5 Replies)
Discussion started by: ramky79
5 Replies

5. Solaris

How to create a simple background script on Solaris

I have a local account for a unix server. The idle timeout for the account is around 10 mins. I have to login to the server multiple times during the day. Is there a way to increase the idle timeout or may be a script that I can run on background so it is not idle. Something like echo date every 9... (3 Replies)
Discussion started by: vinaysa
3 Replies

6. Shell Programming and Scripting

How to create a simple shell script to backup

Hello - I am in process of deleting many files which are older than 4 weeks. For example I am inside: /subsystem/prod/ Files are with various extentions, but anything older than 4 weeks should be deleted. What would be the most simplest script to acheive this? (4 Replies)
Discussion started by: DallasT
4 Replies

7. Shell Programming and Scripting

Create md5 sums and archive the resulting md5 files

Hello everyone, I am looking to basically creating md5sum files for all iso files in a directory and archive the resulting md5 files into a single archive in that very same directory. I worked out a clumsy solution such as: #find files for which md5sum are to be created and store the... (1 Reply)
Discussion started by: SurfTranquille
1 Replies

8. Shell Programming and Scripting

How to create a simple copy script?

Guys I want to do this: copy: /var/router/system1/config/backup/install.put /var/router/system2/config/backup/install.put /var/router/system3/config/backup/install.put /var/router/system4/config/backup/install.put into: /var/router/system1/config/install.dat... (22 Replies)
Discussion started by: DallasT
22 Replies

9. Shell Programming and Scripting

Create simple script

Dear all, I have a directory named A and some subdirectories named B, C, D with .xml files. I want to use the following command to strip the file. sed -re ':start s/<*>//g; /</ {N; b start}' file.xml > file.xml At the same time, I want to remove the blank lines using sed '/^$/d' How can... (6 Replies)
Discussion started by: corfuitl
6 Replies

10. Shell Programming and Scripting

Help making simple perl or bash script to create a simple matrix

Hello all! This is my first post and I'm very new to programming. I would like help creating a simple perl or bash script that I will be using in my work as a junior bioinformatician. Essentially, I would like to take a tab-delimted or .csv text with 3 columns and write them to a "3D" matrix: ... (16 Replies)
Discussion started by: torchij
16 Replies
dput.cf(5)							File Formats Manual							dput.cf(5)

NAME
       dput.cf - Debian package upload tool configuration file

DESCRIPTION
       This manpage gives a brief overview of dput's configuration file and the available options in it.  dput is a tool to upload Debian packages
       to the archive.

FORMAT
       dput.cf consists of different groups of configuration options, one for each host where you want to be able to upload  packages.	Hosts  are
       defined	using  an  identifier header with a short name for the host, enclosed in square brackets.  Note that only if multiple such headers
       are encountered in the configuration, only the group following the last header is considered. This is done to avoid confusion when overrid-
       ing  a global configuration file with a user-specific one.  There's a special identifier, [DEFAULT], which holds default parameters for all
       the hosts. The defaults can be overridden by redefining them again in each host section. The available parameters are listed below:

       fqdn   This is the fully qualified domain name that will be used (can be specified as host:port for HTTP, HTTPS and FTP).

       login  Your login on the machine named before. A single asterisk * will cause the scp and rsync uploaders to not use supply  a  login  name
	      when calling to ssh, scp, and rsync.

       incoming
	      The directory that you should upload the files to.

       method The method that you want to use for uploading the files.	Currently, dput accepts the following values for method:

	      ftp    the  package  will  be  uploaded  via  ftp, either anonymously or using a login/password. Note that ftp is unencrypted so you
		     should not use password authentication with this.

	      http and https
		     the package will be uploaded via http or https using the PUT method as specified in WebDAV. The upload method will prompt for
		     a password if necessary.

	      scp    the  package  will  be  uploaded using ssh's scp. This transfers files using a secure ssh tunnel, and needs an account on the
		     upload machine.

	      rsync  the package will be uploaded using rsync over ssh. This is similar to scp, but can save some  bandwidth  if  the  destination
		     file already exists on the upload server. It also needs a login on the remote machine as it uses ssh.

	      local  the package will be "uploaded" locally using /usr/bin/install.  This transfers files to a local incoming directory, and needs
		     appropriate permissions set on that directory.

       hash   The hash algorithm that should be used in calculating the checksum of the files before uploading them. Currently, dput  accepts  the
	      following values for hash:

	      md5    use the md5 algorithm for calculation

	      sha    use the sha algorithm for calculation

       allow_unsigned_uploads
	      This defines if you are allowed to upload files without a GnuPG signature to this host or not.

       allow_dcut
	      This defines if you are allowed to upload a dcut changes file to the queue to remove or move files.

       distributions
	      This defines a comma-separated list of distributions that this host accepts, used to guess the host to use when none is given on the
	      command line.

       allowed_distributions
	      A regular expression (of Python re module syntax) that the distribution field must match or dput will refuse the upload.

       delayed
	      Set a numeric default parameter for delayed uploads (i.e. uploads to this queue will  be	delayed  the  specified  number  of  days.
	      Defaults to the empty string, meaning no delay. This only works with upload queues that support delayed uploads.

       run_lintian
	      This  option  defines  if lintian should be run before the package will be uploaded or not. If the package is not lintian clean, the
	      upload will not happen.

       run_dinstall
	      This options defines if dinstall -n should be run after the package has been uploaded or not. This is an easy way to  test  if  your
	      package would be installed into the archive or not.

       check_version
	      This  option  defines if dput should check if the user has installed the package in his system for testing it before putting it into
	      the archive. If the user has not installed and tested it, dput will reject the upload.

       passive_ftp
	      This option defines if dput should use passive ftp or active ftp for uploading a package to one of the upload  queues.  By  default,
	      dput uses passive ftp connections. If you need to use active ftp connections, set passive_ftp to 0.

       progress_indicator
	      This integer option defines if dput should display a progress indicator for the upload. (Currently implemented in ftp only.)
	      Supported values: 0 (default) - no progress, 1 - rotating progress indicator, and 2 - kilobyte counter.

       scp_compress
	      This option defines if the scp upload to the host will be compressed, or not.  This option is only used for the 'scp' upload method,
	      and has been found to decrease upload time for slow links, and increase upload times for faster links.

       ssh_config_options
	      The arguments of this config options should be ssh config file options in the style documented in ssh_config(5). They will be passed
	      to  all  automatic  invocations of ssh and scp by dput. Note that you can define multiline (dput) configuration options by indenting
	      the second line with whitespace (i.e. similar to RFC822 header continuations).

       post_upload_command
	      This option defines a command to be run by dput after a successful upload.

       pre_upload_command
	      This option defines a command to be run by dput before a upload happens.

       default_host_main
	      This defines the default host for packages that are allowed to be uploaded to the main archive. This variable is used when  guessing
	      the host to upload to.

BUGS
       Please send bug reports to the author.

FILES
       /etc/dput.cf
	      global dput configuration file

       ~/.dput.cf
	      peruser dput configuration file

AUTHOR
       Christian Kurz. Updated by Thomas Viehmann <tv@beamnet.de>.

       Many other people have contributed to this code. See the Thanks file.

SEE ALSO
       dput(1)
       /usr/share/doc/dput

COMMENTS
       The author appreciates comments and suggestions from you, if any.

								   April 8, 2001							dput.cf(5)
All times are GMT -4. The time now is 06:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy