corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » How do I go about making a CRON job to do these 2 commands???


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author How do I go about making a CRON job to do these 2 commands???
PaulW
Member

Registered: 26th Jan 03
Location: Atherton, Greater Manchester
User status: Offline
12th Jan 06 at 17:48   View User's Profile U2U Member Reply With Quote

code:
wget http://blah/backup.php
wget ftp://blah/poo/ --ftp-user=weee --ftp-password=donk -m -nH


Basically... the wget is used to call a backup script which does a database backup, then second part does complete image of the poo folder from within the host...

I'm using -nH so it doesnt create the folder ftp.blah.com, BUT its still making a poo folder...

how can I make a cron job to do both these tasks as 1 job, in the order above (so FTP only starts AFTER wget has ran)???

cheers
PaulW
Member

Registered: 26th Jan 03
Location: Atherton, Greater Manchester
User status: Offline
12th Jan 06 at 17:50   View User's Profile U2U Member Reply With Quote

also... would this overwrite all existing files with any newer ones & leave all unaltered files intact, or would it not overwrite any files?? as I would of assumed the -m command for wget litterally will 'mirror' the sites contents...
James_DT
Member

Registered: 9th Apr 04
Location: Cambridgeshire
User status: Offline
12th Jan 06 at 18:08   View User's Profile U2U Member Reply With Quote

Write a script that executes those commands, and set the Cron to run the script?
PaulW
Member

Registered: 26th Jan 03
Location: Atherton, Greater Manchester
User status: Offline
12th Jan 06 at 18:28   View User's Profile U2U Member Reply With Quote

have added commands into /etc/cron_dome.sh

tried adding this to cron...

00 03 * * 0 root sh /etc/cron_dome.sh

but doesnt work

tested by making the cron as

50 * * * root sh /etc/cron_dome.sh

so it ran at 10 to 6, but nothing... also restarted cron after updating crontab
willay
Moderator
Organiser: South East, National Events
Premium Member


Avatar

Registered: 10th Nov 02
Location: Roydon, Essex
User status: Offline
12th Jan 06 at 18:43   View Garage View User's Profile U2U Member Reply With Quote

try:

code:

#!/bin/sh
#script to do paulz shit
wget http://blah/backup.php
wget ftp://blah/poo/ --ftp-user=weee --ftp-password=donk -m -nH



then save it somewhere, chmod +x the file (executable) then add the cronentry as /path/to/script.sh (dont put sh at the start)
willay
Moderator
Organiser: South East, National Events
Premium Member


Avatar

Registered: 10th Nov 02
Location: Roydon, Essex
User status: Offline
12th Jan 06 at 18:44   View Garage View User's Profile U2U Member Reply With Quote

also do a whereis wget and get the full path name to wget, then put this into the script as crontab may not be using the same enviromentials as your shell.
willay
Moderator
Organiser: South East, National Events
Premium Member


Avatar

Registered: 10th Nov 02
Location: Roydon, Essex
User status: Offline
12th Jan 06 at 18:45   View Garage View User's Profile U2U Member Reply With Quote

btw - have you considered doing this on the server where the website is hosted? you could do a dirty script to call up tar and make the archive with the date in the filename, then use ftp/scp to transfer the file over to your backup location.
PaulW
Member

Registered: 26th Jan 03
Location: Atherton, Greater Manchester
User status: Offline
12th Jan 06 at 18:50   View User's Profile U2U Member Reply With Quote

i cant do any cron jobs on the server, as its not enabled on the hosting plan

think it didnt work as I was forgetting to chmod +x the file...

testing now
PaulW
Member

Registered: 26th Jan 03
Location: Atherton, Greater Manchester
User status: Offline
12th Jan 06 at 18:54   View User's Profile U2U Member Reply With Quote

cheers willay it really was a case of chmod +x the file!
willay
Moderator
Organiser: South East, National Events
Premium Member


Avatar

Registered: 10th Nov 02
Location: Roydon, Essex
User status: Offline
12th Jan 06 at 18:56   View Garage View User's Profile U2U Member Reply With Quote

elite, though your plan for backups sounds pretty smacky, good luck!
PaulW
Member

Registered: 26th Jan 03
Location: Atherton, Greater Manchester
User status: Offline
12th Jan 06 at 19:05   View User's Profile U2U Member Reply With Quote

lol basically gona backup the entire thing every sunday at 3am... script creates a .SQL.GZ backup of the database on the host, then all contents are backed up...

need to do it so it actually compares file sizes of each file before downloading, otherwise will overwrite everything each time which tbh I only want it to get modified / updated files...

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
help needed for MS-DOS Corsa Sport Gav Geek Day 5 1136
30th Jul 03 at 15:28
by Sam
 
Any MS Excel experts Steve Geek Day 11 1300
4th Jun 04 at 14:19
by blebo
 
FS2004: BHam to Fuerteventura Steve Geek Day 92 2896
2nd Aug 04 at 14:26
by Steve
 
How sad will Ian be...... Matt H General Chat 23 1560
31st Dec 04 at 20:02
by jr
 
In Car Computer software, feature suggestions mikehiow Help Zone, Modification and ICE Advice 10 990
26th Aug 05 at 18:56
by James@CCC
 

Corsa Sport » Message Board » Off Day » Geek Day » How do I go about making a CRON job to do these 2 commands??? 28 database queries in 0.0153830 seconds