anyone for cron?

  • buzzby_247
  • Beginner
  • Beginner
  • buzzby_247
  • Posts: 46

Post 3+ Months Ago

i have searched for cronjob, crontab tutorials but none seem to make any sense to me. needless to say i have never used this before. i need to download a product xml feed (images and descriptions) from a remote server and upload it to another server. this has to be done once a week. i was told that cron does this. the details need to be downloaded then uploaded to the database. reading tutorials on this makes no sense to me. its like describing the colour purple to someone who has been blind from birth. i refuse to believe that it is so difficult that i cant get it. www[.]pantz[.org]/software/cron/croninfo[.html] just doesnt make sense to me. is there anything better out there?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • buzzby_247
  • Beginner
  • Beginner
  • buzzby_247
  • Posts: 46

Post 3+ Months Ago

what is cron limited to? so far from what i have read, cronjob runs a script at a designated time. i want to download information from a server. i have not seen any explanations that handle anything like that or am i just looking in the wrong place?
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

buzzby, think of cron as a job scheduler - I think you would be better off to write a script to handle your needs and then use cron to schedule the job to run once a week. That being said, you've read correctly thus far. Do you have experience with any scripting languages?
  • buzzby_247
  • Beginner
  • Beginner
  • buzzby_247
  • Posts: 46

Post 3+ Months Ago

well i have had some experience with php, a little experience with mysql as well. i am mainly a front end web dev so back end languages are not my forte.

i understand that cronjob schedule times to run tasks. i suppose i want to know how to run a script that will download a file. so there are 2 scripts that need doing. a cronjob script to schedule the time to execute the download. and the other script is the code that will download said file. like i said, i am a nuvice at php and totally new to cronjob
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

Well, you need a script to do the download and then you need to schedule the cron job - that one's not necessarily thought of as a 'script' per say. Have a look at two examples from my own crontab:

Code: [ Select ]
*/5 7-19 * * 1-5 /usr/local/scripts/jary/fill_imagelog.pl
15 21 * * 1-5 /usr/local/scripts/jary/cycleLog.pl
  1. */5 7-19 * * 1-5 /usr/local/scripts/jary/fill_imagelog.pl
  2. 15 21 * * 1-5 /usr/local/scripts/jary/cycleLog.pl


The first runs fill_imagelog.pl M-F, every 5 minutes between 7am and 5pm.

The second runs cycleLog.pl once at 9:15pm M-F.

The format for cron is as follow:
Code: [ Select ]
# MIN HOUR DAYOFMONTH MONTH DAYOFWEEK COMMAND


But if you'd rather, just tell me what day of the week and time you'd like your piece to run and I can tell you this portion.

I prefere to use SimpleXML to parse XML in PHP. You can read up on a primer at this site, or you can google for several other decent tutorials using keywords "PHP simplexml parse xml". If the file is on a remote server, then you need to make sure you're using a solution that implement file_get_contents() so that you can grab the file you need.
  • buzzby_247
  • Beginner
  • Beginner
  • buzzby_247
  • Posts: 46

Post 3+ Months Ago

wow. thanks alot for that. its really helped. you have 2 cronjob scripts working there. similarly i would need 2 also. one to initiate a file that would download a catalog xml file. the other would initiate a file to upload that same catalog xml file to my remote server.

i see from your posting that the 2 files the cronjob accesses are perl scripts. does that mean i need to write 2 perl scripts? 1 perl script to download the file and the other perl script to up load the file? the cronjobs would then activate the perl scripts at the designate time
  • UPSGuy
  • Lurker ಠ_ಠ
  • Web Master
  • User avatar
  • Posts: 2733
  • Loc: Nashville, TN

Post 3+ Months Ago

You see perl scripts in my example simply because that's what I happened to have scheduled on the first 2 lines of this machine. You're not limited to Perl, but you have the general idea correct - two scripts, two cron jobs, and you're done.
  • buzzby_247
  • Beginner
  • Beginner
  • buzzby_247
  • Posts: 46

Post 3+ Months Ago

the next thing i am concerned about is where i store the 2 cronjob files. are they both stored in the same place? on our remote server there is the /etc dir where i have seen various cron dirs. i dont have a server on my local machine. how do i test to see if the download works? i take it a perl or cgi script will handle the actual download activation.
  • buzzby_247
  • Beginner
  • Beginner
  • buzzby_247
  • Posts: 46

Post 3+ Months Ago

i am a bit dubious about downloading files from one server and uploading them to another server without knowing where i am going to store the files. t he cronjob just schedules so i need to write a script that will connect with my ftp then upload various files to various destinations. i am not sure where i would store the files written to do this. the same thing needs to be done for downloading. through more research i have found a software called ScriptFTP. this allows me to create a sheduler for anything i want to download. i then creat an upload script and schedule that to upload what i want wherever i want. the user interface is something that really helps. unfortunately as i have stated before i am not an indepth out and out programmer so this sort of thing really helps. has anyone seen or used this before? (i am not selling scriptFTP, just looking for the best method.) i also need to be able to automate an extraction of a zip file. can perl also do this? once the file has been downloaded i need to extract it then upload it to a different server. whats the best way to go about that?

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 67 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.