HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Screipt that will build a .netrc file (in users HO...
Operating System - HP-UX
1833776
Members
2522
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
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
11-04-2002 08:38 AM
11-04-2002 08:38 AM
Screipt that will build a .netrc file (in users HOME Directory) on the fly.
This script is used you need to put/get files from a server on a regular basis.
#!/usr/bin/sh
#
# This script will create the .netrc with the apwropriate information
# to get the customer data file to 1EDISource.
# Once the script is downloaded, the edi will process the file.
#
# Created By: Richard Hood on Oct. 11, 2002
#
#
# The routine (create_netrc) will build the .netrc,
# The .netrc file is used by ftp and when the edi account
# makes a ftp call to EDI SERVER all the instructions inside
# of the .netrc file will be processed.
#
create_netrc() {
ROUTINE="::create_netrc:"
cat > $HOME/.netrc< machine (PUT SERVER NAME HERE)
login (PUT YOUR USERID HERE...)
password (PUT YOPUR PASSWORD HERE)
macdef init
as
prompt
verbose
lcd ${DIR}
get ${FILENAME}
bye
EOF
check_error
}
#
# This routine (get_file) will read the .netrc file. The ftp process will
# perform the instruction inside of the .netrc file, put the appropriate
# file and place the file in the appropriate directory (tovan).
#
get_file() {
ROUTINE="::get_file:"
ftp -g SERVERNAME >$OFILE 2>&1
rm $HOME/.netrc
check_error
}
move_file() {
ROUTINE="::move_file:"
cp $DIR/${FILENAME} $DIR/NEWFILENAME >$OFILE 2>&1
check_error
}
#
# The below routine (error_msg) will email a message to the appropriate parties
# if any errors occur during the building of the .netrc file or in
# the upload process of the file.
#
check_error() {
STATUS=`echo $?`
if [ ${STATUS} != 0 ]
then
mailx -s"`hostname`: Download Failed" root<
The following ERROR CONDITION occured during $ROUTINE: $STATUS
The above error code resulted in the following error message:
*** `cat $OFILE`
EOF
exit $STATUS
fi
}
OFILE="/tmp/call_output"
DIR="/mnt/transfer/output"
DATE=`date +%Y%m%d`
FILENAME="FILE_NAME${DATE}"
create_netrc
get_file
move_file
#!/usr/bin/sh
#
# This script will create the .netrc with the apwropriate information
# to get the customer data file to 1EDISource.
# Once the script is downloaded, the edi will process the file.
#
# Created By: Richard Hood on Oct. 11, 2002
#
#
# The routine (create_netrc) will build the .netrc,
# The .netrc file is used by ftp and when the edi account
# makes a ftp call to EDI SERVER all the instructions inside
# of the .netrc file will be processed.
#
create_netrc() {
ROUTINE="::create_netrc:"
cat > $HOME/.netrc<
login (PUT YOUR USERID HERE...)
password (PUT YOPUR PASSWORD HERE)
macdef init
as
prompt
verbose
lcd ${DIR}
get ${FILENAME}
bye
EOF
check_error
}
#
# This routine (get_file) will read the .netrc file. The ftp process will
# perform the instruction inside of the .netrc file, put the appropriate
# file and place the file in the appropriate directory (tovan).
#
get_file() {
ROUTINE="::get_file:"
ftp -g SERVERNAME >$OFILE 2>&1
rm $HOME/.netrc
check_error
}
move_file() {
ROUTINE="::move_file:"
cp $DIR/${FILENAME} $DIR/NEWFILENAME >$OFILE 2>&1
check_error
}
#
# The below routine (error_msg) will email a message to the appropriate parties
# if any errors occur during the building of the .netrc file or in
# the upload process of the file.
#
check_error() {
STATUS=`echo $?`
if [ ${STATUS} != 0 ]
then
mailx -s"`hostname`: Download Failed" root<
The following ERROR CONDITION occured during $ROUTINE: $STATUS
The above error code resulted in the following error message:
*** `cat $OFILE`
EOF
exit $STATUS
fi
}
OFILE="/tmp/call_output"
DIR="/mnt/transfer/output"
DATE=`date +%Y%m%d`
FILENAME="FILE_NAME${DATE}"
create_netrc
get_file
move_file
If it ain't broke - Don't fix it
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