views:

304

answers:

1

I am running a ruby script that uses Ruby/MySQL and net/ftp. The script is running on a Windows Vista box and is trying to create a database and ftp connection to the same remote Solaris server.

Here is the gist of the code:

require 'mysql'
require 'net/ftp'

dbh = Mysql.real_connect(db["host"], db["user"], db["pass"], db["name"])
ftp = Net::FTP.new(ftp["host"])

Now, if I run the script from the Vista box that it resides on everything works as it should. However, the script is being called from yet another server via NRPE and that's when the error occurs.

If I set db["host"]/ftp["host"] equal to the fully qualified domain name of the remote server here is the error I receive:

getaddrinfo: no address associated with hostname.

After receiving that error I tried pinging the server from the script and sure enough it failed when trying to ping the hostname, however, it worked when I pinged the IP address.

But then if I set db["host"]/ftp["host"] to the IP address of the remote server I get this error:

The requested service provider could not be loaded or initialized. - socket(2)

I'm having a hard time finding any info on how to debug this, so if anyone has any ideas they will be greatly appreciated.

Thanks in advance.

A: 

Turns out the script was being run remotely from a different user than when it was run locally. I'm not exactly sure what about the environment changed that caused the issue, but once we set up the remote instance to run as the same user as the local everything worked fine.

jonyamo