Find the answer to your Linux question:
Results 1 to 3 of 3
Hey guys, I was wondering how can i write a script that would connect to a remote node through ssh, start a program and exit. It should do this for ...
  1. #1
    Just Joined!
    Join Date
    Jul 2009
    Posts
    4

    Question Connect remotely, start aplication, exit script

    Hey guys,

    I was wondering how can i write a script that would connect to a remote node through ssh, start a program and exit. It should do this for all 9 nodes.

    Code:
    #!/bin/bash
    PATH=$PATH:/usr/local/sbin
    pbs_server
    #
    #First node
    ssh node01
    PATH=$PATH:/usr/local/sbin
    pbs_mom
    logout
    #
    #Second node
    ssh node02
    PATH=$PATH:/usr/local/sbin
    pbs_mom
    logout
    #
    #Third node
    ssh node03
    PATH=$PATH:/usr/local/sbin
    pbs_mom
    logout
    #
    #Fourth node
    ssh node04
    PATH=$PATH:/usr/local/sbin
    pbs_mom
    logout
    #
    #Fith node
    ssh node05
    PATH=$PATH:/usr/local/sbin
    pbs_mom
    logout
    #
    #Sixth node
    ssh node06
    PATH=$PATH:/usr/local/sbin
    pbs_mom
    logout
    #
    #Seventh node
    ssh node07
    PATH=$PATH:/usr/local/sbin
    pbs_mom
    logout
    #
    #Eigth node
    ssh node08
    PATH=$PATH:/usr/local/sbin
    pbs_mom
    logout
    #
    #Nineth node
    ssh node09
    PATH=$PATH:/usr/local/sbin
    pbs_mom
    logout
    The problem with this on is that it stucks either before or after the pbs_mom for the first node.

  2. #2
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    Why have you started another thread on this when you already have one as follows:

    http://www.linuxforums.org/forum/lin...need-help.html

  3. #3
    Linux Newbie egan's Avatar
    Join Date
    Feb 2009
    Location
    Mountain View, CA
    Posts
    132
    Well a start at debugging is to add an echo after the calling of pbs_mom to see whether it makes it passed that point.

    Adding debug prints is a very good way to see where your program goes wrong.

Posting Permissions

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