Script to check MD5SUM on file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to check MD5SUM on file
# 1  
Old 10-16-2010
Script to check MD5SUM of file

Hi,

I currently have a shell script that takes an RPM and scp's it to a set of remote servers and installs it.

What I would like to be able to do is make the script get the md5sum of the RPM locally (so get the md5sum of the rpm from where im running the script) and then scp the rpm to the remote server, and then check the md5sum again, to ensure they match.

If the md5sums match, then continue, if they dont, cancel.

Anyone offer any pointers on how I can do this? Or an example script which I can ammend?

Thank you,

Tom

Last edited by tb1986; 10-16-2010 at 09:02 PM.. Reason: typo
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[md5sum] script

I am getting No such file or directory if my variable contains white spaces... Is there a way to fix this? This works x="1.md5" md5sum -c "$x" This, does not x="23\ 5\ 6\ 7\ 8\ 9\ 10.md5" md5sum -c "$x" md5sum: '23\ 5\ 6\ 7\ 8\ 9\ 10.md5': No such file or directory How do I fix... (1 Reply)
Discussion started by: soichiro
1 Replies

2. Shell Programming and Scripting

Making a script to copy files not seen before (using md5sum)

Hello, I would like to make a script that searches through a SRC folder and copies only files it's never seen before to a DEST folder. SRC = /user/.phonesync/photos-backup DST = /usr/.phonesync/photos-new So basically, I'd start with a: md5sum /user/.phonesync/photos-backup/* >... (29 Replies)
Discussion started by: nbsparks
29 Replies

3. Shell Programming and Scripting

Md5sum script

Hello, I need to download multiple files from an FTP server but occasionally they arrive in error so I need to perform an integrity check. I've been attempting to write a bash script that does the following: Downloads all files including those in sub directories Perform md5sum using... (4 Replies)
Discussion started by: shadyuk
4 Replies

4. Shell Programming and Scripting

md5sum on a file with backslash in its name

Hi there, I found something very weird! Should I report that as a bug or is it me misusing the command? I've got a file with a backslash in its name. I know it's a horrible policy but it's not me. The file came from a mac computer because this is a backup server. Anyway, when using... (8 Replies)
Discussion started by: chebarbudo
8 Replies

5. Shell Programming and Scripting

Using md5sum to name file based on URL

I am trying to download a file and make the filename of the file be the md5sum of the URL. I know to use wgets to download the file but I do not know how to do the rest...any help would be appreciated. (2 Replies)
Discussion started by: The undertaker
2 Replies

6. Shell Programming and Scripting

Duplicate file remover using md5sum--good enough?

This is not a typical question. I have a fully working script but I'm interested in optimizing it. I frequently back up photos and movies from my digital camera and cell phone to both my home/work desktops, laptops, wife's netbook, and my home NAS and often end up with multiple versions of the... (2 Replies)
Discussion started by: Michael Stora
2 Replies

7. Shell Programming and Scripting

Restart script based on MD5sum

Ok, I run a small script, that restarts a perl script when it fails (it's a very unreliable perl script, but I can't change it, it's crucial, and I don't know perl) It outputs data into a logfile. Unfortunately, it also regularly hangs. This is a major problem because if it hangs, no data is... (6 Replies)
Discussion started by: Bakes
6 Replies

8. Shell Programming and Scripting

recursive md5sum check

so I have within my script a little md5sum check... find . ! -type d -print0 | xargs -0 md5sum And I want it to compare the generated values against a file so I'm trying... find . ! -type d -print0 | xargs -0 md5sum -c files.md5 I generated this file by redirecting the output of the... (2 Replies)
Discussion started by: blowFish@ubuntu
2 Replies

9. UNIX for Dummies Questions & Answers

Script to check for a file, check for 2hrs. then quit

I wish to seach a Dir for a specific file, once the file is found i will perform additional logic. If the file is not found within two hours, i would like to exit. Logically, I'm looking for the best way to approach this Thanks for any assistance in advance. Note: I'm using a C shell and... (2 Replies)
Discussion started by: mmarsh
2 Replies

10. UNIX for Dummies Questions & Answers

the file: MD5SUM

i downloaded a Linux distribution from a FTP site today, and i found there is a file named MD5SUM in the same directory, with the following contents: -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 c9a4d963a49e384e10dec9c2bd49ad73 valhalla-SRPMS-disc1.iso 41b03d068e84d2a17147aa27e704f79b ... (1 Reply)
Discussion started by: samprax
1 Replies
Login or Register to Ask a Question
MD5SUM(1)                                                          User Commands                                                         MD5SUM(1)

NAME
md5sum - compute and check MD5 message digest SYNOPSIS
md5sum [OPTION]... [FILE]... DESCRIPTION
Print or check MD5 (128-bit) checksums. With no FILE, or when FILE is -, read standard input. -b, --binary read in binary mode -c, --check read MD5 sums from the FILEs and check them --tag create a BSD-style checksum -t, --text read in text mode (default) The following five options are useful only when verifying checksums: --ignore-missing don't fail or report status for missing files --quiet don't print OK for each successfully verified file --status don't output anything, status code shows success --strict exit non-zero for improperly formatted checksum lines -w, --warn warn about improperly formatted checksum lines --help display this help and exit --version output version information and exit The sums are computed as described in RFC 1321. When checking, the input should be a former output of this program. The default mode is to print a line with checksum, a space, a character indicating input mode ('*' for binary, ' ' for text or where binary is insignificant), and name for each FILE. BUGS
Do not use the MD5 algorithm for security related purposes. Instead, use an SHA-2 algorithm, implemented in the programs sha224sum(1), sha256sum(1), sha384sum(1), sha512sum(1), or the BLAKE2 algorithm, implemented in b2sum(1) AUTHOR
Written by Ulrich Drepper, Scott Miller, and David Madore. REPORTING BUGS
GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report md5sum translation bugs to <http://translationproject.org/team/> COPYRIGHT
Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
Full documentation at: <http://www.gnu.org/software/coreutils/md5sum> or available locally via: info '(coreutils) md5sum invocation' GNU coreutils 8.28 January 2018 MD5SUM(1)