Rsh command

In a script, I set the current date to a variable. I want to use that variable in my rsh command. The variable doesn't work. Here's what I do:
# Setting the current date
EXTENSION=`date "+%m%d%y"`
# Do copy on remote system using current date variable
rsh suntest 'cp /etc/passwd /etc/passwd.$EXTENSION'
When I run this, on the remote system it copies /etc/passwd to /etc/passwd. (passwd followed by period) so I can see it doesn't like $EXTENSION. Is it not possible to do this with 'rsh'?
Thank you!

Try creating a string variable with your command in it and then executing it. Here's sample code from my script:
exec_str="rsh ${SQR_SERVER} ${HOME}/bin/generate_rpt -i $in -o $out -h $host -u $username -p $passwd -a \"$args\" -d $print -q $queue -m \"$mvdir\" > /dev/null 2>&1; /usr/bin/echo \"\$?\""
remote_rc=`$exec_str`

Similar Messages

  • Problem in calling rsh command Please help......

    hi,
    I want to execute some commands on unix through java, for this i want to run my program simulataneously on differnt machines so that i get data to compare.
    I think i have to invoke the rsh command with the machine name for it but it is giving error as follows:
    java.io.IOException: rsh eric52: not found
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:71)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:582)
    at java.lang.Runtime.exec(Runtime.java:505)
    at java.lang.Runtime.exec(Runtime.java:471)
    at RunCommand.get(RunCommand.java:18)
    at RunCommand.main(RunCommand.java:80)
    what should i do?
    How do i run a command on a remote machine?
    Please help me

    Well you could always get your programs to talk to each other via RMI (for example)
    Otherwise I would script this using ant and use ssh since rsh is insecure.
    http://ant.apache.org/manual/OptionalTasks/sshexec.html

  • Want to disable the password while running rsh command on solaris 10

    Hi,
    After executing rsh command it is asking for a password. I want to login to a target machine with rsh command through the scripts which it shouldnot ask for a password. It will be appreciated if anyone can help me in solving out this issue?

    Please type:
    echo "+" > /.rhosts
    or
    echo "%host name of the machine you want to connect%" > /.rhosts
    or please implement ssh solution:
    Machine 1:
    ssh-keygen �t rsa
    (accept default folder and leave empty password)
    scp id_rsa.pub root@%ip_Machine2%:/root/.ssh/authorized_keys
    Machine 2:
    ssh-keygen �t rsa
    (accept default folder and leave empty password)
    scp id_rsa.pub root@%ip_Machine1%:/root/.ssh/authorized_keys
    Regards,
    Daniel

  • Rsh in solaris

    hi guys
    we have moved our apps and db servers physically
    my solaris admin had earlier made a shell script for daily backup of prod system. since we have 2 node configuration,he is calling the second node from 1 st node to stop the apps services. however the rsh command is giving timeout.
    he is using the following line in script
    "rsh prdap -n '/tmp/stopapp.sh >/dev/null 2>&1 </dev/null &'"
    I want to know where is prdap defined as alias for the ap server.
    more hosts --
    127.0.0.1 localhost
    10.224.8.142 faprdap.sog.com faprdap
    192.168.0.2 prdap
    on faprdap.sog.com
    more .rhosts
    faprddb.sog.com root
    prddb root
    However, the apps server is faprdap.I was wondering y he is calling the "prdap" and it was working fine.
    Any help would be appreciated
    Anmol
    ...

    As I understand from your post:
    - Application node hostname: prdap
    - Application node IP Address: 192.168.0.2
    - Database node hostname: prddb
    - Database node IP Address: Unknown
    Your DBA is calling "stopapp.sh" script from the database node to stop the application services using "rsh prdap -n '/tmp/stopapp.sh >/dev/null 2>&1 </dev/null &'"
    faprdap, and faprddb are private interconnect hostnames (addresses) for the application node and the database node respectively which are used for the cluster purpose.

  • Getting return code from remote script after Unix rsh call

    I hope one of you guys can help me with this issue. I think I've gotten the 'rsh' command to work from the CES application so that the sqr report generation can execute on a remote machine (instead of the app server machine). I'm actually doing this by having the app still execute the ces_sqr script, however, now the ces_sqr script will just have an 'rsh' command in it which will cause the actual real sqr processing to occur remotely.
    I am executing a Unix script which does a remote shell call to another script on a remote machine. The remote script sends a return code when run locally, however, how can I get the calling rsh script to get that return code?
    If I do the following in the rsh script:
    rsh -l resdev morph "/dev/bin/remote_script"
    rc=$?
    echo "$rc\n"
    then the return code that I get is not actually the return code from the remote_scrpit, but it is the return code from the rsh command that is 0 (success) because the rsh command actually executed successfully even though the remote_script could've returned something other than success. How can I get the return code from the remote_script passed back to the rsh calling script?
    Jan Miller
    [email protected]
    202-237-9584

    Please ignore the first paragraph of my previous post.

  • Rsh is broke ?? [solved]

    Hi,
    I'm new to Arch. I've installed "openssh", "cvs" and "netkit-rsh" packages using pacman.
    I can ssh into a remote machine without a problem.
    but I can't use cvs to work with a remote repository.
    # cvs -d :ext:username@remote_machine/homes/username/CVS co module
    just hangs!
    i've figured that the rsh command does not run the ssh... hence no logging into the remote machine.
    the following command is executed by cvs.... whose results is nothing!
    # rsh -l username remote_machine cvs server
    by right, rsh should invoke the ssh command, any idea why this doesn't happen?
    I know it doesn't happen, because I don't get asked for my password on the remote machine!
    thanks,
    Shane
    Last edited by punter (2007-08-18 12:42:05)

    Kknd wrote:I'm getting this error too. It just hangs, and I get an "EOF from server". I've tried to use "export CVS_RSH=ssh", but I still get the same thing =/.
    can you ssh into the server without a problem??

  • RSH gethostbyname: Error 0

    Apologies for posting Solaris 8 query in this forum.
    When I try to do a RSH (rsh HOST pwd).
    gethostbyname: Error 0
    gethostbyname: Error 0
    If you see this. The error comes up but still the RSH command works.
    This affects the USFDUMP scheduled backup when I try to do backup to the same remote server (HOST in the above command).
    The error on the UFSDUMP is
    DUMP: Protocol to remote tape server botched (code gethostbyname: Error 0?).
    DUMP: Lost connection to remote host.
    The RSH error doesn't appear if I try to any other SUN servers. It was all working fine until we configured multi-domain setup (DNS) on the servers still all NAME SERVICE provided by the same DNS server.
    To explain, Backup HOST is in TEST domain while Tape HOST is in DEV domain.
    Any help would be very grateful.
    Kumaran

    Hi sathish777,
    Because each domain has its secure boundary ,domain trust is needed for comunication between different domain .
    As a workaround , you may try to logon the "client" locally to be a workgroup machine then use hvremote.swf to manage the hyper-v server remotely :
    https://code.msdn.microsoft.com/Hyper-V-Remote-Management-26d127c6
    Best Regards
    Elton Ji
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Rsh hang when remote host halted

    Solaris 8 on a sunblade 100. Running an rsh command to a remote box hangs when the remote box is killed with halt -q. The rsh command used to illustrate the fault is: rsh -l username hostname sleep 30
    Looking into this, it seems the ndd parameter tcp_keepalive_interval was set to the default 7200000 (2 hours) so I changed it to the minimum of 10000 (10 seconds). Problem pesists. Looking further it seems that setsockopt needs to set SO_KEEPALIVE too. This needs to be done by the rsh internals, not by my command line as I have no knowledge of the underlying socket.
    Searching this site tells me that this was a reported bug in previous versions of the OS, but not in SunOS5.8, check bug id 1075044
    Any help would be appreciated, even if it is to suggest a workaround. I am sending the rsh from a popen in C. At the moment my whole application hangs forever if the remote box is killed.

    Solaris 8 on a sunblade 100. Running an rsh command
    to a remote box hangs when the remote box is killed
    with halt -q. The rsh command used to illustrate the
    fault is: rsh -l username hostname sleep 30
    Looking into this, it seems the ndd parameter
    tcp_keepalive_interval was set to the default 7200000
    (2 hours) so I changed it to the minimum of 10000 (10
    seconds). Problem pesists. Looking further it seems
    that setsockopt needs to set SO_KEEPALIVE too. This
    needs to be done by the rsh internals, not by my
    command line as I have no knowledge of the underlying
    socket.
    Searching this site tells me that this was a reported
    bug in previous versions of the OS, but not in
    SunOS5.8, check bug id 1075044
    Any help would be appreciated, even if it is to
    suggest a workaround. I am sending the rsh from a
    popen in C. At the moment my whole application hangs
    forever if the remote box is killed.Do you observe similar issue if there is a network failure
    that happens inbetween the remote command executing..

  • Return codes using rsh (remote shell) on Solaris

    I am executing a Unix script which does a remote shell call (via rsh) to another script on a remote machine (I am actually executing this from a Java app). The remote script sends a return code when run locally, however, how can I get the calling rsh script to get that return code?
    If I do the following in the rsh script:
    rsh -l resdev morph "/dev/bin/remote_script"
    rc=$?
    echo "$rc\n"
    then the return code that I get is not actually the return code from the remote_scrpit, but it is the return code from the rsh command that is 0 (success) because the rsh command actually executed successfully even though the remote_script could've returned something other than success. How can I get the return code from the remote_script passed back to the rsh calling script? I need to ensure that remote_script executed successfully.
    Jan Miller
    [email protected]
    202-237-9584

    Hi,
    If you have control over the remote script then put as the last line :-
    echo "Run OK" >&2
    On calling Script (or Java Process):
    rsh -l resdev morph "/dev/bin/remote_script" 2> rc.file
    (or pipe stderr to your java process call).
    Check the stderr data='Run OK' to see if successful.

  • How do I tell unix to run a command via AppleScript?

    I have an AppleScript within which I want to start a job running on a remote linux box. Previously in these forums someone helped me do this using the line:
    tell application "Terminal" to do script ("rsh Linux_box -l Myuserid scripttorun")
    however, this creates a Terminal window that hangs around that I'd rather not have there at all. From within the script, can I just tell the underlying unix system to directly run the rsh command without going through a Terminal?
    Thanks.

    Don't tell Terminal, use do shell script:
    do shell script "rsh Linux_box -l Myuserid scripttorun"

  • Problem with rsh (remote shell)

    Hi!
    I'm spanish and my english is not very good. I'm development a soft that connect with router cisco with rsh. And i have to send rsh commands but i can't. From my Linux shell command a request rsh:
    rsh 192.168.1.5 cisco-rsh
    cisco-rsh is a user that has privileges.
    A configuration of my FastEthernet0/0 on my router(cisco 2600) is:
    no ip rcmd domain-lookup
    ip rcmd rcp-enable
    ip rsh-enable
    ip rcmd remote-host cisco-rsh 192.168.1.33 cisco-rsh enable
    ip rcdm remote-username cisco-rsh
    ip rcmd source-interface FastEthernet0/0
    Then what is my problem? only can use rsh because my teacher is required.

    To enable the Cisco IOS software to receive incoming remote shell (rsh) protocol and remote copy (rcp) protocol requests, customers must configure an authentication database to control access to the router. This configuration is accomplished by using the ip rcmd remote-host command.
    http://www.cisco.com/en/US/docs/ios/12_2t/12_2t8/feature/guide/ftAuth.html

  • Help! job scheduled in DB13 cannot run successfully

    Hi! I am a basis administrator of an automobil company.
    Job scheduled in DB13 in our PRD system cannot run successfully.
    We have Central instance(ci) and Database instance(db) installed on seperated hosts. We use SUN cluster 3.1 technology.
    The problem occurs after my college restarted the whole system accidentally. After that, all the job scheduled in DB13 report the same error,job log looks like:
    Job started
    Step 001 started (program RSDBAJOB, variant &0000000000192, user ID ***)
    No application server found on database host - rsh will be used
    Execute logical command BRCONNECT On host orahost
    Parameters: -u / -c -f check
    BR801I BRCONNECT 6.20 (113)
    BR252E Function fopen() failed for '/oracle/PR1/sapcheck/cduuoiij.chk' at location main-8
    BR253E errno 2: No such file or directory
    I manually type the 'rsh' command on ci to invoke 'brconnect' on db. It works all right. And I check the rfc destination 'SAPXPG_DBDEST_ORAHOST' in sm59 , it's normal. There is no gateway instance on database server.
    The parameter 'SAPDBHOST' = orahost (the database server is  called orahost)
    the parameter 'SAPLOCALHOST' = cihost(the central instance is located on cihost)
    Any suggestion is very appreciated.
    Thx!

    Hi Joe,
    DB13 will run only on application server as for that matter any SAP program. It will then connect to database at OS level. I mean you normal reports also fetch data from database for which they have to connect to DB  but they all run on application server. The problem is coming in connection to database through the application layer.
    Please again review the OSS notes sent by Sunil and me. I think a greater focus on Sunil`s notes should help you out.
    Regards.
    Ruchit.

  • Error executing Introscope Enterprise Manager

    Hello,
    I am configuring the Wily Introscope 7.1 as a step for configure the SMD, and I have a problem starting the Enterprise Manager with the command: <i>nohup ./Introscope_Enterprise_Manager&</i>
    It append an output to 'nohup.out', which display the following error:
    <i>java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.</i>
    I have done every step described in the "Introscope Version 7.1Installation Guide For SAP".
    What could be the problem?
    Regards,
    MY

    Hi Miguel,
    I see  two explanations:
    (1) The DISPLAY environment variable is not correctly defined on the remote server; and / or
    (2) The computer from which the rsh command is executed does not allow the display of a "frame" from another host.
    In the first case, one could try on the remote computer:
    set DISPLAY=localComputer:0
    export DISPLAY.
    (depends on the shell may be
    setenv DISPLAY systemname:0.0
    where systemname is the name of your workstation, or some remote system where you want the display directed to).
    In the second case, one could try on the local computer:
    xhost+
    if it helpful reward points are appreciated

  • Network services

    Hi,
    We recently changed our operating system from Solaris 2.5.1 to Solaris 10, and I've got a problem with one of our legacy scripts. This one only makes a few checks ( which are all ok ), and launches a simple rsh command to a raid system to stop it ( with a particular user ). Everything seems right, until this rsh which returns the following error messages :
    "tcgetaddr: no such device or address<br />
    ioctl I_FIND ttcompat: no such device or address"
    Note that we do another rsh just before this one, on the local station and this one is ok. This script is also only useful when the station stops, it does nothing on start.
    An important point is that this legacy script works fine without being executed during the reboot / halt process ( if I launch it manually, everything is ok ).
    I tried to move this legacy script into a service, using dependency feature in case network services are stopped while my script executes, but nothing I tried corrected the problem. I even made a dependency to make my service depend on the zones service, to be sure all network is ok. The service is a transient one ( but I'm a newbie on smf )
    Does someone has any idea about what is going on ? And can someone confirm the fact that if my script depends on the zones service, it will stop before it ?
    Thanks by advance

    Hi,
    We recently changed our operating system from Solaris 2.5.1 to Solaris 10, and I've got a problem with one of our legacy scripts. This one only makes a few checks ( which are all ok ), and launches a simple rsh command to a raid system to stop it ( with a particular user ). Everything seems right, until this rsh which returns the following error messages :
    "tcgetaddr: no such device or address<br />
    ioctl I_FIND ttcompat: no such device or address"
    Note that we do another rsh just before this one, on the local station and this one is ok. This script is also only useful when the station stops, it does nothing on start.
    An important point is that this legacy script works fine without being executed during the reboot / halt process ( if I launch it manually, everything is ok ).
    I tried to move this legacy script into a service, using dependency feature in case network services are stopped while my script executes, but nothing I tried corrected the problem. I even made a dependency to make my service depend on the zones service, to be sure all network is ok. The service is a transient one ( but I'm a newbie on smf )
    Does someone has any idea about what is going on ? And can someone confirm the fact that if my script depends on the zones service, it will stop before it ?
    Thanks by advance

  • Multiple access server issue remotely

    I have two rack with two access server.How can I access both remotely with linksys router.I did port range forwarding but only one rack is accessible.Please advise

    A TCP connection to a router is established using an IP address. Using the host name is valid only when you are initiating an rcp or rsh command from a local router. The host name is converted to an IP address using Domain Name System (DNS) or host-name aliasing. To allow a remote user to execute rcp or rsh commands on a local router, you must create an entry for the remote user in the local authentication database. You must also enable the router to act as an rsh or rcp server. To enable the router to act as an rsh server, issue the ip rcmd rsh-enable global configuration command. To enable the router to act as an rcp server, enter the ip rcmd rcp-enable command. The router cannot act as a server for either of these protocols unless you explicitly enable the capacity

Maybe you are looking for

  • Help with photos lost

    My daughter just sync he'd iPhone to iTunes on MacBook and lost all iPhone photos. Can I retrieve them. She did not photo stream them

  • Unable to complete the installation of Premiere Elements 12

    I am the administrator on my windows 7 box, 64 bit system. PC is clean, runs smooth, run CCleaner several times a day and have no problems downloading and installing other software. I see others have this issue as well.  Error says my machine is not

  • High Dialog response time

    Hi, We have a solman 4.0 system. The average dialog response time of the system is very high. What can be done to bring down this response time?? Thanks in Advance Amit.

  • Windows Server 2012 R2 (VM). KB3000850 installed successfully but then after reboot it couldn't complete update & uninstalls

    Hi, Every time we try to install KB3000850 on a Windows Server 2012 R2 (Virtual), it says it installs successfully, reboots, but then before the logon screen comes up it says "We  couldn't complete the updates, undoing changes..." and it uninstalls t

  • Suddenly no Audio

    I got these used speakers the other day that were better than the ones I was using, so I hooked them up to my computer and no sound. Thinking the speakers just might be bad, I plugged them into an mp3 player and they worked fine. I tried them again i