LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   SCP a file to diff directory/change filename using PHP or call sh script fm PHP (https://www.linuxquestions.org/questions/red-hat-31/scp-a-file-to-diff-directory-change-filename-using-php-or-call-sh-script-fm-php-766941/)

nuebelhor 11-04-2009 08:24 PM

SCP a file to diff directory/change filename using PHP or call sh script fm PHP
 
Hello all,

Been trying different things to no avail, would seem might be a simple fix...trying to just copy a file that will have a different filename every hour over to a generic filename already saved in a different directory to save over old data in the file using PHP script. Actually works when I run manually...but not when ran using crontab, not sure why other than maybe $remote_file doesn't have permissions or something and will only copy when I run it manually? Any simple fix for this?

Been trying to use the system command,

$copy = "scp /usr/local/$remote_file /usr/local/profiler/bby.txt";
system($copy);

Also tried calling a seperate shell_script

system(/usr/local/shell_scripts/send_file.sh $remote_file);

Then shell script has same command as above.

Any help appreciated! Thanks

DrLove73 11-05-2009 08:03 AM

As far as I know, cron has limited sh/bash environment for running scripts. Try redirecting log/errors to a log file to see what's wrong.


All times are GMT -5. The time now is 10:34 AM.