Using korn shell to compare local and remote MD5 over sftp

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











up vote
1
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
    51 mins ago










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










  • New to Korn Scripting
    – arcee123
    50 mins ago










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










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














up vote
1
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
    51 mins ago










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










  • New to Korn Scripting
    – arcee123
    50 mins ago










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










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












up vote
1
down vote

favorite
1









up vote
1
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?







ksh 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 2 mins ago









Isaac

8,05611138




8,05611138






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 53 mins ago









arcee123

106




106




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
    51 mins ago










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










  • New to Korn Scripting
    – arcee123
    50 mins ago










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










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
















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










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










  • New to Korn Scripting
    – arcee123
    50 mins ago










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










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















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




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












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




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












New to Korn Scripting
– arcee123
50 mins ago




New to Korn Scripting
– arcee123
50 mins ago












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




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












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




do you have ksh93 available? (for array support)
– Jeff Schaller
42 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-shell-to-compare-local-and-remote-md5-over-sftp%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-shell-to-compare-local-and-remote-md5-over-sftp%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