- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- About shell script
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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-03-2003 08:15 PM
11-03-2003 08:15 PM
About shell script
for example there is a script called "ux_script" , the user input the file "file1" , then gzip the file1 (the gzipped file should be called file1.gz) , then rcp the file from the path /tmp to /usr .
$pwd
/tmp
$ux_script file1
$cd /usr
$ls -1
file1.gz
On the other hand, the /usr is on the remote system , because the difference of user permission , how can I login the remote system as other user before rcp the file ? thx in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 08:38 PM
11-03-2003 08:38 PM
Re: About shell script
1. The shell script. Here's an example:
--
#!/usr/bin/sh
if [ ! -n "$1" ]
then
echo "Usage: $0 filename"
exit
fi
if [ ! -s $1 ]
then
echo "Cannot read $1"
exit
fi
gzip -c $1 > ${1}.gz && rcp ${1}.gz remotesys:/usr
--
2. The rcp permissions.
For that above rcp to work you need a .rhosts or hosts.equiv entry on the target machine.
eg if your source machine is called "box1" and your userid is "juno2", then on the target system, create a file in your home directory called .rhosts, containing the following line:
box1 juno2
You can test this works by running "remsh remotesys ls" - it should list files on the remote box (box2)
Good luck
-- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 09:04 PM
11-03-2003 09:04 PM
Re: About shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 09:06 PM
11-03-2003 09:06 PM
Re: About shell script
"rcp -l touser"
2. On the target box, put the .rhosts entry in the home directory of touser.
-- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 09:09 PM
11-03-2003 09:09 PM
Re: About shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 09:25 PM
11-03-2003 09:25 PM
Re: About shell script
But if you *want* to enter the password, then change
rcp ${1}.gz remotesys:/usr
to
cat ${1}.gz|rexec remotesys -l touser "cat > /usr/${1}.gz"
-- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 09:52 PM
11-03-2003 09:52 PM
Re: About shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 10:01 PM
11-03-2003 10:01 PM
Re: About shell script
If you are using rexec, the -l is required.
If you are using rcp, the syntax is
different, as follows:
rcp ${1}.gz touser@remotesys:/usr
You will need so set up .rhosts under homedir of touser on remotesys as said earlier.
Hope that does it
-- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2003 10:02 PM
11-03-2003 10:02 PM
Re: About shell script
user_name@hostname:pathname/filename
So:
rcp local-file user_name@hostname:/path/remote_filename
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2003 02:40 PM
11-04-2003 02:40 PM
Re: About shell script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2003 04:32 PM
11-04-2003 04:32 PM
Re: About shell script
$pwd
/tmp
$my_script file1.cdr
$pwd
/usr
$file1.cbt