- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: function through remsh
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
04-14-2003 11:31 AM
04-14-2003 11:31 AM
function through remsh
any ideas??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2003 11:37 AM
04-14-2003 11:37 AM
Re: function through remsh
Using remsh you would run a command that is present on the target node.
so, create the script and save it on the node with the execute permissions all in order.
Thereafter run it from another node using remsh command.
Although I haven't tried it, using sudo is also fine since it would get passed to the shell on the machine on which sudo is configured - as long as your user had sudo authority bestowed in the /etc/sudoers file.
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2003 11:40 AM
04-14-2003 11:40 AM
Re: function through remsh
remsh $HOST "sudo $SCRIPT"
I have two scripts that interact to analyzed disk usage. The first writes the data out in comma delimited format to standard output. The second parses a HOST file and then does:
ssh $HOST:"$SCRIPT">>FILE
FILE is on my local host. This lets me analyzed 20-30 machines at once, appending the output from that remote host onto a file on my local host.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2003 12:01 PM
04-14-2003 12:01 PM
Re: function through remsh
========
get_data()
{
username=john
loginid=johntheman
export username
export loginid
}
creat_user()
{
userad -u 1000 -c $username $loginid
}
exe_another_node()
{
remsh BOX001 "sudo create_user"
}
exe_another_node
=========
will this work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2003 03:14 AM
04-15-2003 03:14 AM
Re: function through remsh
This won't work at all. remsh opens a shell on the remote host specified and then runs the command specified within that shell. So, your function and its declaration are not visible to the remsh call, or the remote host.
try this -
remsh
that should return the hostname of the remote host. so, that means that the hostname command is called from within the remsh shell and it has to be present on the target node.
see man remsh for more details.
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2003 03:35 AM
04-15-2003 03:35 AM
Re: function through remsh
Try this -
export username=$1
export loginname=$2
export uid=$3
eval "remsh
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2003 03:38 AM
04-15-2003 03:38 AM
Re: function through remsh
Donny,
# cat abc.sh
#!/usr/bin/ksh
export username=$1
export loginname=$2
export uid=$3
eval "remsh
# EOF
run as follows -
# ./abc.sh ramd "Ramkumar" 1000
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2003 05:25 PM
04-15-2003 05:25 PM
Re: function through remsh
I got it to work, after many hours of sweat, but guess what there is more limitations.
ok, let me 1st explain what I did to make it happen.
I have 2 scripts, one call it master on the main server.
and the other call it client.
now what I wanted to achieve was to allow the master to remsh into the client, then feed the client some variables, the client then executes his script with the variables supplied.
then when the client finishes, it needs to supply me a return code.
here is the trick.
master:
ok I have a list of variables already populated.
say -- db[0] .. db[9] all with different values and textl.
>>
DOIT=`remsh remote "client ${db[*]}`
echo ${DOIT} | read RETURN
echo $RETURN
# I use the value of $RETURN to do other tasks
client:
the client script read the variables supplied from the master script.
I assign inside the script those variables as $1 .. $9
NUM=$1; export $NUM
etc
then in the client script, I create say a useraccount.
the useraccount has a return code, which I assign to a variable
then I use return to send the variable back to the master.
return ${RETURN_CODE}
sounds cumbersome, but it works very well.
also, I never knew there is a limit on the total amount of characters sent back over a remsh = 10 max. by return function. discovered that today.
anyway thanx for your help.