SUMMARY: Question about redirect

From: Steve Devine <sdevine_at_msu.edu>
Date: Thu May 30 2002 - 08:12:00 EDT
Thanks to all ... your responses were greatly appreciated.
"Ya wouldn't  'a thought this would be so hard.."

Original problem:
When using scp with a script I was unable to capture its output.
scp normally returns a 'progress meter' style of message .
This doesn't seem to be able to be redirected in the 
usual manner. 
This would not work:
/usr/local/bin/scp -p /dir/dir/file.tar root@server:/dir/dir/  >/tmp/ouptut
Nor did about 5 other styles of using redirect. 
So at the advice of those acknowledged below I had scp return 
a exit status and crafted a email to be sent accordingly.  

---------------------------------------
#!/bin/sh
/usr/local/bin/scp -p /dir/dir/file.tar root@server:/dir/dir/  
hold=$?
if [ $hold = 0 ];
then
echo "Files transferred" >/tmp/output
/bin/mailx -s "File Transfer "  me@msu.edu </tmp/output
else
echo "File transfer has failed" >/tmp/output
/bin/mailx -s "File Transfer Failed"  me@msu.edu </tmp/output
fi
------------------------

David Morris <davey@arklight.demon.co.uk>
system administration account <sysadmin@astro.su.se>
Darren Dunham <ddunham@taos.com>

Thanks to All

-- 
Steve Devine   
Michigan State University



To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the engineer, the glass is twice as big as it needs to be.
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Thu May 30 08:24:48 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:44 EST