File: nplaunch

package info (click to toggle)
netpipe 3.7.2-8
  • links: PTS
  • area: main
  • in suites: buster, sid
  • size: 1,188 kB
  • sloc: ansic: 7,588; makefile: 279; sh: 63; perl: 45; csh: 25
file content (39 lines) | stat: -rwxr-xr-x 790 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /bin/csh -f
# Example:  nplauch NPtcp -h remote_host [options]
# Works with NPtcp, NPgm, NPib, NPpvm

set NEXT_ARG="no"
set REMOTE_HOST=""
set REMOTE_COMMAND=""
set LOCAL_COMMAND="$*"

echo "$LOCAL_COMMAND"
echo "$REMOTE_COMMAND"

foreach ARG ( $* )
#   echo $ARG
   if( $NEXT_ARG == "yes" ) then
      set REMOTE_HOST="$ARG"
      set NEXT_ARG="no"
   else
      if( "$ARG" == "-h" ) then
         set NEXT_ARG="yes"
      else
         if( "$REMOTE_COMMAND" == "" ) then
            set REMOTE_COMMAND="$cwd/$ARG"
         else
            set REMOTE_COMMAND="$REMOTE_COMMAND $ARG"
         endif
      endif
   endif
end

#echo $LOCAL_COMMAND
#echo $REMOTE_COMMAND
#exit

# Now launch the remote executible using ssh

ssh -x -a $REMOTE_HOST "$REMOTE_COMMAND" &
sleep 5
$LOCAL_COMMAND