Executing commands remotely

Zach

Diamond Member
Oct 11, 1999
3,400
1
81
I have two webservers, and I need to execute commands on one system by running scripts on another (for setting up accounts). What's the best method? I don't even know what to look for in the How-To's. I'll be using Perl mostly, and I've chatted with a guy doing simaler things by binding scripts to specific ports. Security is a concern, but I have a backend network using non-routable IP's..

What's the best method? Without any help I'd just be setting up cron jobs to look for changes on the 'main' system via nfs mounts and coordinating settings through that. Oh, and I should mention that I'm running Linux (Redhat 7).
 

kranky

Elite Member
Oct 9, 1999
21,020
156
106
Can you use rlogin from perl? I don't know for sure with Linux, but that's what we did with our Unix systems.
 

nd

Golden Member
Oct 9, 1999
1,690
0
0
Well, the wonderful thing about UNIX is that there are probably hundreds of ways to do this.

Here's some ideas:

- rexec/rsh: These aren't used very often anymore I think, but they will do exactly what you want. See "man rcmd" for more information.
- Code a simple daemon (perl is fine) that listens on some port, accepts connections from only your other machine and does some simple text negotiation to get the parameters and then just executes the script (or runs the code inside the daemon). Then code a client for talking to that daemon for your other box.

 

Zach

Diamond Member
Oct 11, 1999
3,400
1
81
Don't know how good I'd be at making daemons in perl to listen to ports. Hopefully I can use or hack something already out there... never looked for it before but also never seen it.
 

nd

Golden Member
Oct 9, 1999
1,690
0
0
People have done this stuff so much I'm sure you'll be able to make us of existing code. Go search freshmeat for some perl daemons.
 

kranky

Elite Member
Oct 9, 1999
21,020
156
106
I'd vote for nd's first suggestion of rexec/rsh. That's going to be easier, IMHO.