• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Shell script not working in 64bit environment.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shell script not working in 64bit environment.


  • Subject: Re: Shell script not working in 64bit environment.
  • From: "Mark J. Reed" <email@hidden>
  • Date: Wed, 28 Jul 2010 18:28:17 -0400

On Wed, Jul 28, 2010 at 2:42 PM, Eric Saunders <email@hidden> wrote:
> set themessage to "echo -ne \"WF01\"MYDOMAINGOESHERE\"\\\\\"" & gid &
> "\"\\0\" > /dev/udp/" & NETSPECTIVEIP & "/2020 | /bin/bash"
>
> do shell script themessage

Some of this doesn't make sense. You're sending a message over UDP to
a bunch of servers, which is fine, but you seem to be expecting to get
some output back, which doesn't work.  UDP is one-way, connectionless;
as far as I can tell, that echo command will never have any output, so
themessage will always be empty.

What's also weird is that if there were any output, you would treat it
as a shell script, and run it - and then take the output of THAT shell
script and treat IT as a shell script and run IT! Three levels of code
generation!

So I think the whole "set themessage to ".../"do shell script
themessage" pair of lines can be replaced with a single do shell call:

do shell script "echo -ne \"WF01MYDOMAINGOESHERE\\\\" & gid & "\\0\"
>/dev/udp/" & NETSPECTIVEIP & "/2020"

(I also got rid of some extra quotation marks in the shell script that
aren't really doing anything.)

Now.  You're sending a UDP packet containing the string "WF01DOMAIN\",
followed by the user's id, followed by a null byte, to port 2020 on
the Netspective server.  Check.  What's supposed to happen on the
server at that point?  And how do you know if it succeeded?  Can you
access debug logs  on the server, see if it received the packet and,
if so, what its exact contents were?

You might try standing up a simple UDP server on another host and
replacing the ip/port with that.  If you still have the working 10.5
install, you could try sending to it from both to see what the
difference is.

For instance, you could use this perl script as your test server:

#!/usr/bin/perl
use IO::Socket;
use strict;
my $port = shift || 2020;
my $sock = IO::Socket::INET->new(LocalPort  => $port,
                              Proto     => 'udp')
        or die "bind: $!\n";
my $buf;
$sock->recv($buf, 1024) or die "recv: $!\n";
print "Received ", length($buf), " bytes: '$buf'\n";
(my $hex = unpack("H*", $buf)) =~ s/../$& /g;
print "$hex\n";


--
Mark J. Reed <email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Shell script not working in 64bit environment. (From: Eric Saunders <email@hidden>)

  • Prev by Date: Re: Is there any way to move to a certain position in AppleScript Editor 2.3
  • Next by Date: Public Domain Library Lister
  • Previous by thread: Re: Shell script not working in 64bit environment.
  • Next by thread: Public Domain Library Lister
  • Index(es):
    • Date
    • Thread