HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell script
Operating System - HP-UX
1833760
Members
2190
Online
110063
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2003 07:58 PM
06-08-2003 07:58 PM
Hi All,
I am modifying a working script.In this script there is an rcp command to copy some files from one system to another system.
A part of the script:
*************************
if [ $age_in -gt 120 ]
then
ll $procfile >> $log_dir/instore$mt.log
cat $procfile >> $log_dir/instore$mt.log
rcp $raw_dir/instore/$procfile abcd@efgh:/user_ef/efgh/rawdat
a/instore
$par_dir/instore/rawconv.pl $raw_dir/instore/$procfile
$par_dir/instore/instoreup $raw_dir/instore/rawdata.out
cat $procfile >> $bak_dir/instore/$mth/$today.ins
$proc_dir/instore/$time.ins
rm -f $procfile
rm -f $raw_dir/instore/rawdata.out
fi
****************************
Here my requirement is to put a check on the rcp.
If the rcp is successful then proceed with the next command or else copy the content to another local folder in the same system. How do I do it?
Thanks for your help.
I am modifying a working script.In this script there is an rcp command to copy some files from one system to another system.
A part of the script:
*************************
if [ $age_in -gt 120 ]
then
ll $procfile >> $log_dir/instore$mt.log
cat $procfile >> $log_dir/instore$mt.log
rcp $raw_dir/instore/$procfile abcd@efgh:/user_ef/efgh/rawdat
a/instore
$par_dir/instore/rawconv.pl $raw_dir/instore/$procfile
$par_dir/instore/instoreup $raw_dir/instore/rawdata.out
cat $procfile >> $bak_dir/instore/$mth/$today.ins
$proc_dir/instore/$time.ins
rm -f $procfile
rm -f $raw_dir/instore/rawdata.out
fi
****************************
Here my requirement is to put a check on the rcp.
If the rcp is successful then proceed with the next command or else copy the content to another local folder in the same system. How do I do it?
Thanks for your help.
Everything is possible
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2003 08:41 PM
06-08-2003 08:41 PM
Re: shell script
Perform an 'remsh abc@defg 'll [directory]/[filename]' |grep [filename] |wc -l
The grep and wc -l are outside the remsh, any value of 0 indicates error, any value of 1 indicates failure.
Share and Enjoy! Ian
The grep and wc -l are outside the remsh, any value of 0 indicates error, any value of 1 indicates failure.
Share and Enjoy! Ian
Building a dumber user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2003 09:06 PM
06-08-2003 09:06 PM
Solution
rcp $raw_dir/instore/$procfile abcd@efgh:/user_ef/efgh/rawdat
a/instore
rc=$?
if [ $rc ne 0 ]
echo "The rcp failed"
mailx -s "rcp failed" yourmail@yourdomain.net
fi
You could obviously remesh to the other system and run a check script but I doubt that would work if the rcp command failed.
Anyway there are dozens of possible solutions here.
SEP
a/instore
rc=$?
if [ $rc ne 0 ]
echo "The rcp failed"
mailx -s "rcp failed" yourmail@yourdomain.net
fi
You could obviously remesh to the other system and run a check script but I doubt that would work if the rcp command failed.
Anyway there are dozens of possible solutions here.
SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2003 07:44 AM
06-09-2003 07:44 AM
Re: shell script
Run a checksum on both sides of the rcp command--good for files up to 2GB.
SOURCESUM=`sum -r $SOURCFILE|awk '{ print $1 }'
DESTSUM=`rsh $DESTHOST sum -r $DESTFILE|awk '{ print $1 }'`
if test "$SOURCESUM" -eq "$DESTSUM"
then
echo "copy was successful"
else
echo "copy was unsuccessful"
fi
This guarantees a byte-for-byte copy.
Chris
SOURCESUM=`sum -r $SOURCFILE|awk '{ print $1 }'
DESTSUM=`rsh $DESTHOST sum -r $DESTFILE|awk '{ print $1 }'`
if test "$SOURCESUM" -eq "$DESTSUM"
then
echo "copy was successful"
else
echo "copy was unsuccessful"
fi
This guarantees a byte-for-byte copy.
Chris
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP