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??? » Post Reply

Post Reply
Who Can Post? All users can post new topics and all users can reply.
Icon:
Formatting Mode:
Normal
Advanced
Help

Insert Bold text Insert Italicized text Insert Underlined text Insert Centered text Insert a Hyperlink Insert Email Hyperlink Insert an Image Insert Code Formatted text Insert Quoted text
Message:
HTML is Off
Smilies are On
BB Code is On
[img] Code is On
Post Options: Disable smileys?
Turn BBCode off?
Receive email notification of new replies?

PaulW

posted on 12th Jan 06 at 19:05

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...


willay

posted on 12th Jan 06 at 18:56

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


PaulW

posted on 12th Jan 06 at 18:54

cheers willay :thumbs: it really was a case of chmod +x the file!


PaulW

posted on 12th Jan 06 at 18:50

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


willay

posted on 12th Jan 06 at 18:45

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.


willay

posted on 12th Jan 06 at 18:44

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

posted on 12th Jan 06 at 18:43

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)


PaulW

posted on 12th Jan 06 at 18:28

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 :boggle:

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


James_DT

posted on 12th Jan 06 at 18:08

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


PaulW

posted on 12th Jan 06 at 17:50

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...


PaulW

posted on 12th Jan 06 at 17:48

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