Web Design Forum: Cron Job's - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Cron Job's Rate Topic: -----

#1 User is offline   Lee_K 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 43
  • Joined: 19-October 11
  • Reputation: 0

Posted 26 January 2012 - 02:34 AM

Ok, so i'm trying to set up a cronjob and noticed that my server only allows 3 cronjob's per account. So is it possible to run multiple scripts inside of 1 file? All running at the same time?

Thanks!
0

#2 User is offline   simplypixie 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 62
  • Joined: 23-November 11
  • Reputation: 11
  • Gender:Female
  • Location:Shropshire
  • Experience:Intermediate
  • Area of Expertise:Web Developer

Posted 26 January 2012 - 08:13 AM

Sounds like you may be on the same hosting as me as I had exactly the same problem / thought a few weeks ago.

Yes, just set up your script with all the different functionality you need as the cronjob doesn't care what is in your script, it is just there to run the set script at the specified times.
1

#3 User is offline   Lee_K 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 43
  • Joined: 19-October 11
  • Reputation: 0

Posted 26 January 2012 - 09:20 PM

Thanks! So I just repeat my script in the file?
0

#4 User is offline   getty 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 26
  • Joined: 25-January 12
  • Reputation: 2
  • Gender:Male
  • Experience:Nothing
  • Area of Expertise:Designer

Posted 26 January 2012 - 09:41 PM

You could use switch statements and set identities for every function I suppose. Although it does need a bit of automation, the script has to check the server time first of all using date() and pull the list of scripts that needs to be executed at that certain point.

Code reference:
$timeNow = strtotime(date('G-i-s'));

switch($timeNow){
case '10023021':
executesql_query(PARAM);
break;
}

This post has been edited by getty: 26 January 2012 - 09:48 PM

1

#5 User is offline   Lee_K 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 43
  • Joined: 19-October 11
  • Reputation: 0

Posted 26 January 2012 - 11:30 PM

Thanks for that! I'm going to have a look into it now see what I can do!
0

#6 User is offline   Lee_K 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 43
  • Joined: 19-October 11
  • Reputation: 0

Posted 27 January 2012 - 10:31 AM

Can anyone point me in the right direction with this? Any usefull links or anything? Google doesn't seem to throw up all that much! How do I know if my host has wget? I've sent an email off but had no reply yet. Any other way to find out?
0

#7 User is offline   getty 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 26
  • Joined: 25-January 12
  • Reputation: 2
  • Gender:Male
  • Experience:Nothing
  • Area of Expertise:Designer

Posted 27 January 2012 - 01:14 PM

Who's your hosting provider?
0

#8 User is offline   Lee_K 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 43
  • Joined: 19-October 11
  • Reputation: 0

Posted 27 January 2012 - 02:37 PM

fasthostingdirect.co.uk
0

#9 User is offline   getty 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 26
  • Joined: 25-January 12
  • Reputation: 2
  • Gender:Male
  • Experience:Nothing
  • Area of Expertise:Designer

Posted 27 January 2012 - 11:37 PM

These commands are usually available on every standard web hosting packages:
bunzip2
bzip2
cat
chmod
cp
cpio
doscvt
grep
gzip
hostname
ln
login
ls
mkdir
more
mv
od
rm
sh
tar
touch
unzip
vi
zcat


I haven't found an article of ssh commands list for fashostingdirect, couldn't find it on their website either.

Though if you're wondering what command to use for creating a cron job, use crontab -e, press i and insert your cron command: run a query.php everyday for example:
0 0 * * * php /www/query.php
Then press escape followed by ':' and type 'wq' to save the command. crontab -l to list all the existing cron job commands.

This post has been edited by getty: 27 January 2012 - 11:41 PM

0

#10 User is offline   Lee_K 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 43
  • Joined: 19-October 11
  • Reputation: 0

Posted 28 January 2012 - 02:14 AM

SSH isn't enabled as standard with my hosting. I have to apply to enable it. So i'm guessing once that's enabled then the above will be available to me? I have applied to have it enabled since my last email to them but not had a reply yet.
0

#11 User is offline   getty 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 26
  • Joined: 25-January 12
  • Reputation: 2
  • Gender:Male
  • Experience:Nothing
  • Area of Expertise:Designer

Posted 28 January 2012 - 02:51 AM

Yes, it should. That's how I would do it as I make scheduled tasks for sending e-mails automatically everyday.
0

#12 User is offline   Lee_K 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 43
  • Joined: 19-October 11
  • Reputation: 0

Posted 29 January 2012 - 05:15 PM

Ok well wget and gzip are both working on the server and I have the right file path's for both of them, but i'm not really any further forward!

Basically I need to set up a cron job that will download a number of CSV files from a URL and then import them into my database, overwriting the originals... But I havn't a clue where to start!

This post has been edited by Lee_K: 29 January 2012 - 05:16 PM

0

#13 User is offline   Lee_K 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 43
  • Joined: 19-October 11
  • Reputation: 0

Posted 29 January 2012 - 11:46 PM

Am I right in thinking that I need to use wget to download my CSV files, gzip to unzip them within the server, then use another script to import them into my database?
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users