1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Execute script on remote server

Discussion in 'Site & Server Administration' started by israel, Apr 1, 2006.

  1. #1
    Hi!,
    I've got a problem. I ve got a server A and a server B. On server A there is a Apache. I've got a Perl or Bash script used to add an user account (username and other information about new account are the parameters of the script). How to write a php page (running on Apache on server A) that could execute my Bash/Perl script on server B.
    thanks for your help,
    sorry for my english ;)
     
    israel, Apr 1, 2006 IP
  2. sacx13

    sacx13 Active Member

    Messages:
    438
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Hi,

    $host=escapeshellarg($args);
    $cmd=escapeshellcmd("adduser.pl ".$args);
    $r=shell_exec($cmd);


    Regards
    Adrian
     
    sacx13, Apr 1, 2006 IP
  3. israel

    israel Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Will it works in MS Windows ? I though this command runs command only on a server where web server stands?
    I think my question is not precisly.
    I want to open this php page on another computer - let's call it C - there would be a field to enter a username etc. for new account. Then I'll click OK and new account will be create on server B.
     
    israel, Apr 1, 2006 IP
  4. sacx13

    sacx13 Active Member

    Messages:
    438
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Your adduser.pl or adduser.sh (perl / bash) need to do a remote ssh (with key auth) and add your user.

    syntax is something like : ssh host command

    but you need to generate a pair of keys for ssh to work withou "keyboard" auth !

    Regards
     
    sacx13, Apr 1, 2006 IP
  5. israel

    israel Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks,
    Ive though about it but Ive got one script that create account on linux machine and one for windows machine.
    Solution with ssh for linux is no problem but what about windows ?
     
    israel, Apr 1, 2006 IP
  6. sacx13

    sacx13 Active Member

    Messages:
    438
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #6
    Open ssh is runnign on windows too ... try cygwin ...

    Regards
     
    sacx13, Apr 2, 2006 IP