HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Cron Job Backup.

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#45776 (In Topic #10013)
Avatar

Community saint

Anybody have a cron job that auto backs up at 1 AM for a linux server ? Or know how to set one up?

Not that I'm lazy I just fear Alzheimer's will be setting in any day now.

ocP Ver 4.1
Back to the top
 
Posted
Rating:
#45778
Avatar

Community saint

00 01 * * * bash /path/to/ftp.backup.script.sh I had to go look at what I had cause I, too, am getting too old to remember. :$
Back to the top
 
Posted
Rating:
#45779
Avatar

Community saint

I should add that I am using centos 5.
Back to the top
 
Posted
Rating:
#45780
Avatar

Community saint

You know what, that should be just 0 1***/root/backup.sh
Back to the top
 
Posted
Rating:
#45781
Avatar

Community saint

I'll give it a try.

Thanks Psydoc!

ocP Ver 4.1
Back to the top
 
Posted
Rating:
#45782
Avatar

Community saint

You are welcome. In any event the syntax should be something like this.

Your cron job looks like as follows:
1 2 3 4 5 /path/to/command arg1 arg2

Where,

 * 1: Minute (0-59)
 * 2: Hours (0-23)
 * 3: Day (0-31)
 * 4: Month (0-12 [12 == December])
 * 5: Day of the week(0-7 [7 or 0 == sunday])
 * /path/to/command

If you wished to have a script named /root/backup.sh run every day at 1am, my crontab entry would look like as follows:

Install your cronjob:# crontab -e

Append following entry:0 1 * * * /root/backup.sh
Back to the top
 
Posted
Rating:
#45783
Avatar

Community saint

By default the output of a command or a script (if any produced), will be emailed to the email account on your server. To stop receiving email output from crontab you need to append >/dev/null 2>&1.

For our example,:0 1 * * * /root/backup.sh >/dev/null 2>&1

To mail output to particular email account (xzy@yhy.com) you need to the define MAILTO variable to your cron job:MAILTO="xzy@yhy.com"

MAILTO="xzy@yhy.com"
0 1 * * * /root/backup.sh </dev/null 2>&1

sorry I didn't finish that the first post.:$


Last edit: by psydoc
Back to the top
 
Posted
Rating:
#45784
Avatar

Community saint

First you should prolly list what crons you have:

# crontab -l

If you have one for backup, you can edit it or start over by removing it:

You may want to ask bash for help to remove the one you want –help
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: