tags:

views:

55

answers:

3

Let me start by saying that I know nothing about Cron, so sorry. How can I make a php or perl script get files from my computer and upload them to my web server everyday at midnight?

The webserver is linux. The computer from which the files need to be retrieved is Windows.

A: 

One solution would be to put an FTP server on your server and use the FTP functions PHP has to upload (using FTP ofcourse) from your computer to the server.
I assume it is obvious there are "some" security issues with approach you should take extra care to handle.

Itay Moav
How would I do that?
Christopher
@Christopher "One cow at a time, and we'll eat the entire herd" Did you install FTP server on the machine you wish to upload to files?
Itay Moav
+1  A: 

Cron will start a script or run a command on the local computer (the computer running cron) at regular intervals. If you can run a script on your computer that will upload files to your webserver, then cron can schedule that script to run at midnight every night. (Assuming you're running an operating system that has cron or something cron-like.) Cron will not, however, help you write the script to upload the files.

Scott Saunders
+1  A: 

Assuming you are running Linux, the below commands will show you the relevant manual pages:

man cron      # man page for cron
man 1 crontab # man page for "crontab" program that installs and edits crontabs
man 5 crontab # man page for cron schedule files (called "crontabs")

Basically, cron runs commands from a schedule. The schedule is called a "crontab", and the command that installs and edits them is also called a "crontab". You could use

crontab -e

to edit your crontab in an editor. Or you could create a crontab file and then just install it using

crontab file_to_use_as_crontab

To see your current crontab, use

crontab -l

The crontab file format can be cryptic. The below example crontab executes /fully/qualified/path/to/script_that_copies_files every day at midnight. Fully qualifying the path to your script is recommended.

# minute hour day month dayofweek
0 0 * * * /fully/qualified/path/to/script_that_copies_files
Russell Silva