This is a discussion on Shell script to perform operation on remote server within the Shell scripting forums, part of the Development/Scripting category; Hello I have a backup server. And I want to do this following operation 1. ssh to that backup server ...
|
|||||||
| Register | FAQ | Members List | Calendar | Forgotten your password? | Mark Forums Read |
|
|||
|
Hello
I have a backup server. And I want to do this following operation 1. ssh to that backup server (the remote server is already paired with my server,so no password entering screen) 2. fetch www.abc.com/file.zip 3. scp file.zip root@myserver.com:/home/user/www/file.zip Its not joke, I know I can do this operation with wget. But its not what I want. Because, The remote backup server only allows FTP and SSH access. There is no http access( the server is rsyncpalace.com) So, I have coded like this <?php $command="ssh user@backupserver.com"; // demo server $output=shell_exec($command); $command="fetch http://definitions.symantec.com/defs/20071022-017-v5i32.exe"; $output=shell_exec($command); // Sample file $command="scp user@myserver.com:/home/user/www/20071022-017-v5i32.exe"; $output=shell_exec($command); // Sample file print "<pre>$output</pre>\n"; //show output ?> But It did not work. Can anyone please let me know how to do this work? I want php code. not pure shell code. Not sure, how .cgi file will work , no idea Please help me Thanks |
| Sponsored Links | ||
|
|
|
|||
|
ok,almost all problems are solved now with the help of
nixCraft - Linux sys admin blog by Vivek But I need 1 and only last help I need to execute this command using PHP FILE Code:
rsync -v -e ssh user@remoteserver.com:~/back/file.tar.gz /home/user/www/1 This will download a file called file.tar.gz from a remote server,remoteserver.com and will save it into /home/user/www/1 I checked this command via putty and is working. But I need to add this command to a php file so that when a php file called download.php will execute, then this code must be executed. How to do that ? Any idea ? Thanks |
|
|||
|
File : .cgi-bin/file.cgi
Code:
#!/bin/sh echo Content-type: text/html echo echo echo "<HTML>" echo "<HEAD>" echo "</HEAD>" echo "<BODY>" echo "<H2>Hard disk info:</H2>" echo "<PRE>" df-h echo "</PRE>" echo "</BODY>" echo "</HTML>" I want to replace "df -h" with this command Code:
rsync -v -e ssh user@remoteserver.com:~/back/file.tar.gz /home/user/www/1 ![]() |
![]() |
| Bookmarks |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Tomcat shell script cron job to restart server | kasimani | Shell scripting | 4 | 05-03-2008 08:46 PM |
| script hangs when a remote server is down | vikas027 | Shell scripting | 2 | 11-11-2007 04:47 PM |
| Shell script to check the disk space on remote systems | vijayscripts | Shell scripting | 5 | 10-21-2007 07:29 PM |
| Linux Shell script to mount remote windows share | angelus_kit | Shell scripting | 2 | 09-06-2007 08:18 PM |
| Shell script to monitor remote local http or port 80 | amigo28 | Shell scripting | 1 | 02-12-2007 10:58 PM |