Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, i configuared ssh for server(rac1,rac2). i have created one script in rac1 node. i am getting following error when execute script in RAC1: rac1-~> one.sh echo "Welcome" in RAC2: ...
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    1

    Smile how to call shell script from another node?

    Hi,

    i configuared ssh for server(rac1,rac2). i have created one script in rac1 node. i am getting following error when execute script

    in RAC1:
    rac1-~> one.sh
    echo "Welcome"

    in RAC2:

    rac2-~>cat two.sh
    ssh rac1 one.sh
    echo "Welcome to ALL"

    rac2-~>sh two.sh
    sh:command not found

    Thanks,

  2. #2
    Linux Enthusiast meton_magis's Avatar
    Join Date
    Oct 2006
    Location
    arizona
    Posts
    665
    you need to add
    #!/bin/bash

    to the top of your shell script. Also, you need to put the absolute path (the entire path to the file, like /home/user/one.sh, or whatever) into your scripts, not just the name of the file.

    what you are doing is trying to run a script with no interpretor, which just wont work. You need the #!/bin/bash line to tell your shell what to run the script through. The reason for the absolute paths is so that there is no ambiguety for your shell as to where the file is, since you dont have a pwd on your remote server when your calling that file (I think you technicaly do, but the way I showed you is safer.) then you need to run `chmod ug+x one.sh` on both the scripts, replacing the one.sh with two.sh for that one.
    New to the internet, technical forums, or the hacker / open source community??
    Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html

    RHCE for RHEL version 5
    RHCT for RHEL version 4

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...