LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 08-04-2009, 10:42 AM   #1
Myiagros
Member
 
Registered: Mar 2009
Distribution: Ubuntu, CentOS 5.3
Posts: 75

Rep: Reputation: 18
rsnapshot not automating backups


I've been having an issue with rsnapshot not automating the backups. I can run the command "rsnapshot hourly" and it will go through the backup process which is taking directories off of up to 20 workstations. The cron job however will not run rsnapshot. Here is what my crontab looks like:

0 */4 * * * /usr/local/bin/rsnapshot hourly
30 22 * * * /usr/local/bin/rsnapshot daily
0 0 * * 5 /usr/local/bin/rsnapshot weekly
0 3 15 */3 * /usr/local/bin/rsnapshot monthly

I set this up on Friday so this morning there should have been 6 hourly backups complete, 4 daily, and 1 weekly yet there was only the 1 hourly that I had run manually. rsnapshot is running on our raid server which is currently only at FC4.1
 
Old 08-04-2009, 11:03 AM   #2
ABL
Member
 
Registered: Mar 2005
Location: NYC
Distribution: CentOS 5
Posts: 54

Rep: Reputation: 16
Sorry, if you've tried this already, but have you tried to just run:
/usr/local/bin/rsnapshot hourly
?

Did it work?

If so, are your permissions in the crontab the same as the user you ran:
/usr/local/bin/rsnapshot hourly under?

Do you have any other items in your crontab? Do they work?

If none of this is helpful, perhaps you can post your rsnapshot.conf file here.

Good luck,
Alden
 
Old 08-04-2009, 11:15 AM   #3
Myiagros
Member
 
Registered: Mar 2009
Distribution: Ubuntu, CentOS 5.3
Posts: 75

Original Poster
Rep: Reputation: 18
I am running rsnapshot as root and the command does work for /usr/local/bin/rsnapshot hourly
The only other things in the crontab are the default listings for /etc/cron.daily and such.

Here is my rsnapshot.conf

Quote:
#######################
# CONFIG FILE VERSION #
#######################

config_version 1.2

###########################
# SNAPSHOT ROOT DIRECTORY #
###########################

# All snapshots will be stored under this root directory.
#
snapshot_root /exports/data/.snapshots/
#link_dest 1

# If no_create_root is enabled, rsnapshot will not automatically create the
# snapshot_root directory. This is particularly useful if you are backing
# up to removable media, such as a FireWire or USB drive.
#
#no_create_root 1

#################################
# EXTERNAL PROGRAM DEPENDENCIES #
#################################

# LINUX USERS: Be sure to uncomment "cmd_cp". This gives you extra features.
# EVERYONE ELSE: Leave "cmd_cp" commented out for compatibility.
#
# See the README file or the man page for more details.
#
cmd_cp /bin/cp

# uncomment this to use the rm program instead of the built-in perl routine.
#
cmd_rm /bin/rm

# rsync must be enabled for anything to work. This is the only command that
# must be enabled.
#
cmd_rsync /usr/bin/rsync

# Uncomment this to enable remote ssh backups over rsync.
#
cmd_ssh /usr/bin/ssh

# Comment this out to disable syslog support.
#
cmd_logger /usr/bin/logger

# Uncomment this to specify the path to "du" for disk usage checks.
# If you have an older version of "du", you may also want to check the
# "du_args" parameter below.
#
#cmd_du /usr/bin/du

# Uncomment this to specify the path to rsnapshot-diff.
#
#cmd_rsnapshot_diff /usr/local/bin/rsnapshot-diff

# Specify the path to a script (and any optional arguments) to run right
# before rsnapshot syncs files
#
#cmd_preexec /path/to/preexec/script

# Specify the path to a script (and any optional arguments) to run right
# after rsnapshot syncs files
#
#cmd_postexec /path/to/postexec/script
#########################################
# BACKUP INTERVALS #
# Must be unique and in ascending order #
# i.e. hourly, daily, weekly, etc. #
#########################################

interval hourly 6
interval daily 7
interval weekly 4
interval monthly 3

############################################
# GLOBAL OPTIONS #
# All are optional, with sensible defaults #
############################################

# Verbose level, 1 through 5.
# 1 Quiet Print fatal errors only
# 2 Default Print errors and warnings only
# 3 Verbose Show equivalent shell commands being executed
# 4 Extra Verbose Show extra verbose information
# 5 Debug mode Everything
#
verbose 2

# Same as "verbose" above, but controls the amount of data sent to the
# logfile, if one is being used. The default is 3.
#
loglevel 3

# If you enable this, data will be written to the file you specify. The
# amount of data written is controlled by the "loglevel" parameter.
#
logfile /var/log/rsnapshot

# If enabled, rsnapshot will write a lockfile to prevent two instances
# from running simultaneously (and messing up the snapshot_root).
# If you enable this, make sure the lockfile directory is not world
# writable. Otherwise anyone can prevent the program from running.
#
lockfile /var/run/rsnapshot.pid

# Default rsync args. All rsync commands have at least these options set.
#
#rsync_short_args -a
#rsync_long_args --delete --numeric-ids --relative --delete-excluded
#--rsync-path=rsync_wrapper.sh

# ssh has no args passed by default, but you can specify some here.
#
#ssh_args -p 22

# Default arguments for the "du" program (for disk space reporting).
# The GNU version of "du" is preferred. See the man page for more details.
# If your version of "du" doesn't support the -h flag, try -k flag instead.
#
#du_args -csh

# If this is enabled, rsync won't span filesystem partitions within a
# backup point. This essentially passes the -x option to rsync.
# The default is 0 (off).
#
#one_fs 0

# The include and exclude parameters, if enabled, simply get passed directly
# to rsync. If you have multiple include/exclude patterns, put each one on a
# separate line. Please look up the --include and --exclude options in the
# rsync man page for more details on how to specify file name patterns.
#
#include ???
#include ???
exclude variant/
exclude INCA_libs/
exclude simulation/work/

# The include_file and exclude_file parameters, if enabled, simply get
# passed directly to rsync. Please look up the --include-from and
# --exclude-from options in the rsync man page for more details.
#
#include_file /path/to/include/file
#exclude_file /path/to/exclude/file

# If your version of rsync supports --link-dest, consider enable this.
# This is the best way to support special files (FIFOs, etc) cross-platform.
# The default is 0 (off).
#
#link_dest 0

# When sync_first is enabled, it changes the default behaviour of rsnapshot.
# Normally, when rsnapshot is called with its lowest interval
# (i.e.: "rsnapshot hourly"), it will sync files AND rotate the lowest
# intervals. With sync_first enabled, "rsnapshot sync" handles the file sync,
# and all interval calls simply rotate files. See the man page for more
# details. The default is 0 (off).
#
#sync_first 0

# If enabled, rsnapshot will move the oldest directory for each interval
# to [interval_name].delete, then it will remove the lockfile and delete
# that directory just before it exits. The default is 0 (off).
#
#use_lazy_deletes 0

# Number of rsync re-tries. If you experience any network problems or
# network card issues that tend to cause ssh to crap-out with
# "Corrupted MAC on input" errors, for example, set this to a non-zero
# value to have the rsync operation re-tried
#
#rsync_numtries 0

###############################
### BACKUP POINTS / SCRIPTS ###
###############################

# LOCALHOST
#backup /home/ localhost/
#backup /etc/ localhost/
#backup /usr/local/ localhost/
#backup /var/log/rsnapshot localhost/
#backup /etc/passwd localhost/
#backup /home/foo/My Documents/ localhost/
#backup /foo/bar/ localhost/ one_fs=1, rsync_short_args=-urltvpog
#backup_script /usr/local/bin/backup_pgsql.sh localhost/postgres/

# EXAMPLE.COM
backup root@willard:/home/ willard/
backup root@willard:/etc/ willard/
backup root@ioman:/home/ ioman/
backup root@ioman:/etc/ ioman/
backup root@finkyboy:/home/ finkyboy/
backup root@finkyboy:/etc/ finkyboy/
backup root@finkyboy:/var/ finkyboy/
backup root@katana:/home/ katana/
backup root@katana:/etc/ katana/
#backup root@machina:/home/ machina/
#backup root@machina:/etc/ machina/
backup root@goge:/home/ goge/
backup root@goge:/etc/ goge/
backup root@cyrus:/home/ cyrus/
backup root@cyrus:/etc/ cyrus/
backup root@titan:/home/ titan/
backup root@titan:/etc/ titan/
backup root@poseidon:/home/ poseidon/
backup root@poseidon:/etc/ poseidon/
backup root@crimson:/home/ crimson/
backup root@crimson:/etc/ crimson/
backup root@ruby:/home/ ruby/
backup root@ruby:/etc/ ruby/
backup root@sabre:/home/ sabre/
backup root@sabre:/etc/ sabre/
backup root@scarlett:/home/ scarlett/
backup root@scarlett:/etc/ scarlett/

Last edited by Myiagros; 08-04-2009 at 11:18 AM. Reason: crontab info
 
Old 08-04-2009, 11:27 AM   #4
ABL
Member
 
Registered: Mar 2005
Location: NYC
Distribution: CentOS 5
Posts: 54

Rep: Reputation: 16
Does your log file have anything in it?/var/log/rsnapshot

If not, would you please set verbose and loglevel to 5, temporarily, to see if we can find something?

I am wondering if your crontab is perhaps not being run at all.
 
Old 08-04-2009, 11:40 AM   #5
Myiagros
Member
 
Registered: Mar 2009
Distribution: Ubuntu, CentOS 5.3
Posts: 75

Original Poster
Rep: Reputation: 18
The only information in /var/log/rsnapshot is from when I run it manually through command line.

crond is set to on in chkconfig list and service --status-all states that crond is running.
 
Old 08-04-2009, 12:33 PM   #6
ABL
Member
 
Registered: Mar 2005
Location: NYC
Distribution: CentOS 5
Posts: 54

Rep: Reputation: 16
Does cron.allow exist? If so, make sure that crontab (with its path) is there.
Does cron.deny exist? If so, make sure your crontab isn't in there.
If neither exists, then I believe that only superuser (or root) can have a crontab
So, create a blank cron.deny in your /etc directory (touch cron.deny)

One other item: before your command, /usr/loca/bin/rsnapshot daily, have you tried to put the username you want to run under? E.g.,
5 * * * * RSnapUser /usr/local/bin/rsnapshot daily

If none of those are it, you've exhausted my limited knowledge!
 
Old 08-04-2009, 12:40 PM   #7
Myiagros
Member
 
Registered: Mar 2009
Distribution: Ubuntu, CentOS 5.3
Posts: 75

Original Poster
Rep: Reputation: 18
There is no cron.allow, cron.deny is there but it is empty. I'll attempt to add a user within the crontab then leave it go overnight and see if it runs the backup.
 
Old 08-04-2009, 12:53 PM   #8
ABL
Member
 
Registered: Mar 2005
Location: NYC
Distribution: CentOS 5
Posts: 54

Rep: Reputation: 16
Quote:
Originally Posted by Myiagros View Post
There is no cron.allow, cron.deny is there but it is empty. I'll attempt to add a user within the crontab then leave it go overnight and see if it runs the backup.
I'm sorry, I meant that you may need the user before EACH command in the crontab. That is:
5 * * * * RSnapUser /usr/local/bin/rsnapshot hourly
15 1 * * * RSnapUser /usr/local/bin/rsnapshot daily
25 3 1 * * RSnapUser /usr/local/bin/rsnapshot monthly
etc.
 
Old 08-04-2009, 03:36 PM   #9
cmdln
Member
 
Registered: Apr 2009
Location: Lawrence, KS
Distribution: Debian, Centos
Posts: 102
Blog Entries: 1

Rep: Reputation: 24
When you do get your cron working I do not believe that config is going to do what you expect.

Your config says hourly 6, daily 7, weekly 4, monthly 3

rsnapshot does not work exactly how your thinking.

The way rsnapshot works when the daily is run is that it copies hourly.6 to daily.0. And when the weekly job runs it copies daily.7 to weekly.0 and again when monthly runs it copys weekly.5 to monthly.0.

Since you have hourly set to run every 4 hours and you want 6 intervals it will take 24 hours before you have the 6th snapshot. Since you dont have the 6th snapshot when daily runs nothing will happen. It will take 7 days before you have enough dailys to let a weekly run.

The thing to watch out for here is that if you set it up friday you wont see a monthly, or a weekly even though you crossed both of those boundaries. Does that make sense? Its probably not the expected behavior for most people so just be aware of how it works.

The other thing to keep in mind on this is the daily job will be the oldest available hourly backup at the time when daily runs so in your config the daily backp would really be a snapshot of things 24 hours previous (or there about) depending on exactly when you have your crons scheduled. Its that old because its pulling off of daily.6 wich runs every 4 hours so thats about 24 hours ago.

I hope that helps you understand how rsnaphsot really works.
 
Old 08-05-2009, 08:51 AM   #10
Myiagros
Member
 
Registered: Mar 2009
Distribution: Ubuntu, CentOS 5.3
Posts: 75

Original Poster
Rep: Reputation: 18
Thumbs up

It is now working. Adding the user to the crontab made it work, the hourly has run 3 times now since yesterday afternoon.
 
  


Reply

Tags
crontab, rsnapshot


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remote rsync/rsnapshot backups as a limited privelege user Vanyel Linux - Software 1 07-30-2009 10:27 AM
Rsnapshot du automation steven19782007 Linux - Newbie 2 06-11-2009 01:42 AM
LXer: TIP: Automating Website Backups LXer Syndicated Linux News 0 12-06-2008 10:10 AM
LXer: rsnapshot - Local/Remote Filesystem backups utility in openSUSE LXer Syndicated Linux News 0 10-06-2008 07:41 PM
Backups with rsnapshot jeremy LQ Articles Discussion 0 07-30-2007 12:58 PM


All times are GMT -5. The time now is 06:08 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration