Using KORN to compare local and remote MD5

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite
1












I am in need of creating and checking checksums between a local file, and the remote file I just pushed. If the MD5 checks, continue, else break. This needs to be in KORN shell scripting because we are using AIX machines.



here's the code I have so far:



for file in <<Directory>>; do
-- Get MD5 of local file
LOCALMD5=!chsum "$(basename "$file")"
sftp <<USER>>@<<IP>> <<EOF
PUT file <<SFTP OUTPUT FOLDER>>
REMOTEMD5= <<<COMMAND HERE>>>> <<--- HELP NEEDED HERE
IF [[LOCALMD5!=REMOTEMD5]]; THEN
RETURNVALUE = -1
BREAK
done

print RETURNVALUE


How do I get the remote MD5 checksum?










share|improve this question









New contributor




arcee123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Are you actually calling cksum, or is chsum some other local utility/function/wrapper?
    – Jeff Schaller
    30 mins ago










  • this is new code, so we are using cksum right now.
    – arcee123
    30 mins ago










  • New to Korn Scripting
    – arcee123
    29 mins ago










  • do you have csum available? (AIX 7's supports MD5)
    – Jeff Schaller
    23 mins ago










  • do you have ksh93 available? (for array support)
    – Jeff Schaller
    22 mins ago














up vote
0
down vote

favorite
1












I am in need of creating and checking checksums between a local file, and the remote file I just pushed. If the MD5 checks, continue, else break. This needs to be in KORN shell scripting because we are using AIX machines.



here's the code I have so far:



for file in <<Directory>>; do
-- Get MD5 of local file
LOCALMD5=!chsum "$(basename "$file")"
sftp <<USER>>@<<IP>> <<EOF
PUT file <<SFTP OUTPUT FOLDER>>
REMOTEMD5= <<<COMMAND HERE>>>> <<--- HELP NEEDED HERE
IF [[LOCALMD5!=REMOTEMD5]]; THEN
RETURNVALUE = -1
BREAK
done

print RETURNVALUE


How do I get the remote MD5 checksum?










share|improve this question









New contributor




arcee123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • Are you actually calling cksum, or is chsum some other local utility/function/wrapper?
    – Jeff Schaller
    30 mins ago










  • this is new code, so we are using cksum right now.
    – arcee123
    30 mins ago










  • New to Korn Scripting
    – arcee123
    29 mins ago










  • do you have csum available? (AIX 7's supports MD5)
    – Jeff Schaller
    23 mins ago










  • do you have ksh93 available? (for array support)
    – Jeff Schaller
    22 mins ago












up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





I am in need of creating and checking checksums between a local file, and the remote file I just pushed. If the MD5 checks, continue, else break. This needs to be in KORN shell scripting because we are using AIX machines.



here's the code I have so far:



for file in <<Directory>>; do
-- Get MD5 of local file
LOCALMD5=!chsum "$(basename "$file")"
sftp <<USER>>@<<IP>> <<EOF
PUT file <<SFTP OUTPUT FOLDER>>
REMOTEMD5= <<<COMMAND HERE>>>> <<--- HELP NEEDED HERE
IF [[LOCALMD5!=REMOTEMD5]]; THEN
RETURNVALUE = -1
BREAK
done

print RETURNVALUE


How do I get the remote MD5 checksum?










share|improve this question









New contributor




arcee123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I am in need of creating and checking checksums between a local file, and the remote file I just pushed. If the MD5 checks, continue, else break. This needs to be in KORN shell scripting because we are using AIX machines.



here's the code I have so far:



for file in <<Directory>>; do
-- Get MD5 of local file
LOCALMD5=!chsum "$(basename "$file")"
sftp <<USER>>@<<IP>> <<EOF
PUT file <<SFTP OUTPUT FOLDER>>
REMOTEMD5= <<<COMMAND HERE>>>> <<--- HELP NEEDED HERE
IF [[LOCALMD5!=REMOTEMD5]]; THEN
RETURNVALUE = -1
BREAK
done

print RETURNVALUE


How do I get the remote MD5 checksum?







aix sftp hashsum






share|improve this question









New contributor




arcee123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




arcee123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 31 mins ago









Jeff Schaller

33.8k851113




33.8k851113






New contributor




arcee123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 32 mins ago









arcee123

101




101




New contributor




arcee123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





arcee123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






arcee123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • Are you actually calling cksum, or is chsum some other local utility/function/wrapper?
    – Jeff Schaller
    30 mins ago










  • this is new code, so we are using cksum right now.
    – arcee123
    30 mins ago










  • New to Korn Scripting
    – arcee123
    29 mins ago










  • do you have csum available? (AIX 7's supports MD5)
    – Jeff Schaller
    23 mins ago










  • do you have ksh93 available? (for array support)
    – Jeff Schaller
    22 mins ago
















  • Are you actually calling cksum, or is chsum some other local utility/function/wrapper?
    – Jeff Schaller
    30 mins ago










  • this is new code, so we are using cksum right now.
    – arcee123
    30 mins ago










  • New to Korn Scripting
    – arcee123
    29 mins ago










  • do you have csum available? (AIX 7's supports MD5)
    – Jeff Schaller
    23 mins ago










  • do you have ksh93 available? (for array support)
    – Jeff Schaller
    22 mins ago















Are you actually calling cksum, or is chsum some other local utility/function/wrapper?
– Jeff Schaller
30 mins ago




Are you actually calling cksum, or is chsum some other local utility/function/wrapper?
– Jeff Schaller
30 mins ago












this is new code, so we are using cksum right now.
– arcee123
30 mins ago




this is new code, so we are using cksum right now.
– arcee123
30 mins ago












New to Korn Scripting
– arcee123
29 mins ago




New to Korn Scripting
– arcee123
29 mins ago












do you have csum available? (AIX 7's supports MD5)
– Jeff Schaller
23 mins ago




do you have csum available? (AIX 7's supports MD5)
– Jeff Schaller
23 mins ago












do you have ksh93 available? (for array support)
– Jeff Schaller
22 mins ago




do you have ksh93 available? (for array support)
– Jeff Schaller
22 mins ago















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






arcee123 is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474645%2fusing-korn-to-compare-local-and-remote-md5%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








arcee123 is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















arcee123 is a new contributor. Be nice, and check out our Code of Conduct.












arcee123 is a new contributor. Be nice, and check out our Code of Conduct.











arcee123 is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f474645%2fusing-korn-to-compare-local-and-remote-md5%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay