Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
FunFiler wrote:
The delay on startup is all that my 2 systems require. After that, the cron daemon stays active with the correct content. What other services are you running? Maybe one of them is causing cron to die.
In my fun_plug.local I restart Samba with a custom config and start OpenVPN and Twonky services. How could I tell if either of them are interfering with crond?
Offline
Try disabling them for a couple of days, one at a time. I doubt it is samba, I do the same thing. I don't run a media server though, I just access via a share. I'd suspect that since it uses a lot of memory.
Last edited by FunFiler (2011-04-18 05:27:40)
Offline
FunFiler wrote:
Try disabling them for a couple of days, one at a time. I doubt it is samba, I do the same thing. I don't run a media server though, I just access via a share. I'd suspect that since it uses a lot of memory.
Okay, I'll report back if I find anything in a couple weeks. I'll have to check it every day for awhile to get an idea of how often it drops out (as a baseline) before I disable stuff so I can see for sure if there is any improvement.
Thanks.
Offline
Hi to anyone who can help me,
I'm having trouble getting my backup to run via cron schedule. i've read all 13 pages of this post and i noticed other people came across this issue aswell, no matter what i do i cannot see it in the schedule.
crontab -l produces
59 1 * * * /usr/sbin/daylight&
30 2 * * * /usr/sbin/stime&
32 2 * * * /usr/sbin/rtc -s
30 2 2 * * /usr/sbin/rtc -c
i can manually run the back up through telnet via the following command (it took over 24 hrs but at least i have it.
/mnt/HD_a2/fun_plug.d/bin/rsync -rlptDv --delete /mnt/HD_a2 /mnt/HD_b2 >/mnt/HD_a2/fun_plug.d/log/rsync.last.log 2>&1
and after several reboots and rechecking crontab -l I still get no overnight backup or schedule to run.
Im using ffp 0.5 do i need to install anything else to make this happen?
I was originally running Raid 1 and tried to implement a 3rd hdd hoping it would rebuild and thus have an offsite back up, but that became more complicated by the minute, so now Rsync is the way of the future for me if only i can get it automated.
Thanks in advance
Okadz
Last edited by Okadz (2011-05-31 15:02:32)
Offline
Okadz wrote:
Hi to anyone who can help me,
I'm having trouble getting my backup to run via cron schedule.
But you didn't tell us what you're doing to schedule the cron job. What command/script are you running?
Last edited by scaramanga (2011-05-31 15:17:27)
Offline
thanks scaramanga
yeah sorry forgot to mention that, ive followed the tutorial as per wiki, and the start of this thread.
#!/bin/sh
CRONTXT=/mnt/HD_a2/crontab.txt
# start with existing crontab
/bin/crontab -l > $CRONTXT
# add the Rsync job to execute at 2:05 am - also create a logfile
/bin/echo "5 2 * * * /mnt/HD_a2/fun_plug.d/bin/rsync -rlptDv --delete /mnt/HD_a2 /mnt/HD_b2 >/mnt/HD_a2/fun_plug.d/log/rsync.last.log 2>&1" >> $CRONTXT
# install the new crontab
/bin/crontab $CRONTXT
# clean up
/bin/rm $CRONTXT
then 'a'
:wq
reboot
as far as i was aware thats all i need to do to add it to the schedule?
Offline
oh and i made it executeable - chmod a+x /mnt/HD_a2/ffp/start/editcron.sh
Last edited by Okadz (2011-05-31 15:46:43)
Offline
Try adding a delay at the beginning of the script. It seems that the cronjobs get reset during bootup.
Example:
# Add a delay to work around a bootup timing issue if [ "$1" == "start" ]; then echo "Default mode - Adding a 5 minute startup delay" /ffp/bin/sleep 5m fi
Offline
Thanks funfiler
I tried adding the delay and initially it didnt seem to change anything, so i just rewrote the whole script again via vi including the delay and now I can see it listed in crontab -l
root@!@#$:~# crontab -l
59 1 * * * /usr/sbin/daylight&
30 2 * * * /usr/sbin/stime&
32 2 * * * /usr/sbin/rtc -s
30 2 2 * * /usr/sbin/rtc -c
5 2 * * * /mnt/HD_a2/ffp/bin/rsync -rlptDv --delete /mnt/HD_a2 /mnt/HD_b2 >/mnt/HD_a2/ffp/log/rsync.last.log 2>&1
Thanks for the help, now to see if it runs over night.
Offline
Im back again with another Q
My backups have been running smoothly every night, so thanks again everyone.
If i want to backup all of Vol A to Vol B except for a single directory would my line of code be as follows
5 2 * * * /mnt/HD_a2/ffp/bin/rsync -rlptDv --delete --exclude '/mnt/HD_a2/this directory' /mnt/HD_a2 /mnt/HD_b2 >/mnt/HD_a2/ffp/log/rsync.last.log 2>&1
Thanks Okadz
Offline
Add --dry-run. This will not make any changes to files, just list what it's going to do. With --dry-run, you can experiment with command lines and test what's going to happen.
Offline
Thanks scaramanga
where do i add --dry-run before --delete or after the --exclude command or doesnt it matter?
Offline
It's just one of the (many many) options so it comes before the source and destination. Also, don't place it between the --exclude and '/mnt/HD_a2/this directory', which is its argument. The order of the options isn't important.
See detailed documentation here: http://www.samba.org/ftp/rsync/rsync.html
Offline
Hi,
I have been trying for days to enable backup in one night, but encounter an error in the proposed variant Wiky that suggests to insert snapshots ... especially andthe problem is that at the end of the first full backup does not create a link to the current file ... is normal? do not get mad when it should create it ....
Can you explain how this snapshot? thanks:
my files:
snapshot:
#!/bin/sh
# Set Source Path
# Back up the A drive (HD_a2) by identifying the source path as /mnt/HD_a2
srcpath=/mnt/HD_a2
# Back up multiple directories by surrounding a list with single quotes (i.e., srcpath='/mnt/HD_a2/Music /mnt/HD_$
# srcpath='/mnt/HD_a2/Music /mnt/HD_a2/Docs'
# Set the Destination Path
dstpath=/mnt/HD_b2/Backup_NAS
# Set path to Fun_Plug files
# Fun_Plug 3.0 or 4.0
# ffppath=/mnt/HD_a2/fun_plug.d
# Fun_Plug 5.0
ffppath=/ffp
date=`date "+%Y%m%d_%H%M%S"`
mkdir $dstpath/$date
$ffppath/bin/rsync -avx --exclude-from=/mnt/HD_a2/exclude.txt --link-dest=$dstpath/current $srcpath $dstpath/$dat$
var=`ls -1A $dstpath/$date | wc -l`
if [ $var -ne 0 ]
then
rm $dstpath/current
ln -s $date $dstpath/current
fi
editcron:
#!/bin/sh
CRONTXT=/mnt/HD_a2/crontab.txt
# start with existing crontab
/bin/crontab -l > $CRONTXT
# add the Rsync job to execute at 2:05 am - also create a logfile
#/bin/echo "5 2 * * * /mnt/HD_a2/ffp/bin/rsync -rlptDv --delete /mnt/HD_a2 /mnt/HD_b2 >/mnt/HD_a2/ffp/log/rsync.l$
# add the Rsync job to execute at 2:00 am
/bin/echo "0 2 * * * /ffp/bin/snapshot.sh" >> $CRONTXT
# install the new crontab
/bin/crontab $CRONTXT
# clean up
/bin/rm $CRONTXT
Offline
Replace this:
ln -s $date $dstpath/current
With this:
ln -s $dstpath/$date $dstpath/current
By the way, your script will replace the current link even if the backup is incomplete for some reason.
Offline
Thanks scaramanga
Now I'm using your script to remove some files after a while ... but I realized that the disk is full where I bkup fact I use a 750GB as the source and a 350 as a backup ... There is no way to shrink the files .... Once backupppati?
thanks
PS I'm looking for a 750GB while
Offline
My script? Did I post the latest one, which will not delete the old backup if the current one failed? and that sends the log file to your email?
Can't remember.
Offline
I have been using rsync to perform this type of backup, as I don't want to trust the RAID implementation (also, if something accidentally gets erased, it's gone from both drives).
I noticed that there is a hidden directory called .systemfile on the /mnt/HD_a2 and /mnt/HD_b2 directories, and they are not the same following the rsync - can someone explain what this directory is used for by the system, and is it recreated on startup?
Thanks.
Offline
scaramanga wrote:
My script? Did I post the latest one, which will not delete the old backup if the current one failed? and that sends the log file to your email?
Can't remember.
Hi
I am using this script:
#!/bin/sh
############
# Settings #
############
# Set source and exculde rules to govern what should be backed-up.
#srcPath="/mnt/HD_a2/Photos /mnt/HD_a2/Documents /mnt/HD_a2/ffp /mnt/HD_a2/downloads"
srcPath=/mnt/HD_a2
excludeRules="--exclude-from=/mnt/HD_a2/exclude.txt"
# Set destination path, i.e. where should the backup be placed.
baseDstPath="/mnt/HD_b2/Backup_NAS"
rsyncOpts="-ahHvx --fuzzy --stats"
# What is the maximum number of backups to keep. If there are more,
# the oldest will be deleted.
maxSnapshotCount=30
###################
# Run Environment #
###################
# Set path to Fun_Plug files.
# Fun_Plug 3.0 or 4.0
# ffppath=/mnt/HD_a2/fun_plug.d
# Fun_Plug 5.0
ffppath=/ffp
#
# Commands
#
rsyncCmd="${ffppath}/bin/rsync"
dateCmd="/bin/date"
lsCmd="/bin/ls"
rmCmd="/bin/rm"
lnCmd="/bin/ln"
wcCmd="${ffppath}/bin/wc"
headCmd="/bin/head"
echoCmd="/bin/echo"
mkdirCmd="/ffp/bin/mkdir"
#
# Backup locations and file names
#
dstName=$(${dateCmd} "+%Y%m%d_%H%M%S")
dstPath="${baseDstPath}/${dstName}"
dstLog="${dstPath}/snapshot.log"
currLink="${baseDstPath}/current"
##########
# Backup #
##########
${mkdirCmd} -p ${dstPath}
${echoCmd} Executing ${rsyncCmd} ${rsyncOpts} --link-dest=${currLink} ${excludeRules} ${srcPath}
${dstPath} >> ${dstLog}
${echoCmd} "== ${rsyncCmd} log start ===================================" >> ${dstLog}
${rsyncCmd} ${rsyncOpts} --link-dest=${currLink} ${excludeRules} ${srcPath} ${dstPath} >> ${dstLog} 2>&1
rsyncRC=$?
${echoCmd} "== ${rsyncCmd} log end =====================================" >> ${dstLog}
if test ${rsyncRC} -eq 0; then
${rmCmd} ${currLink}
${lnCmd} -s ${dstName} ${currLink}
else
${echoCmd} "Something went wrong during backup (rc=${rsyncRC}). Current won't be updated." >>
${dstLog}
fi
######################
# Remove Old Backups #
######################
# Only delete old backups if current succeeded
if test ${currLink} -ef ${dstPath}; then
cd ${baseDstPath}
# Count how many backups there are, which is given by: ls -1A <base-dst-dir> | wc
# subtract 1 for current link
snapshotCount=$(( $(${lsCmd} -1A . | ${wcCmd} -l) - 1 ))
if test ${snapshotCount} -gt ${maxSnapshotCount}; then
# Please note that the output from ls is sorted in the correct order
snapshotRemoveCount=$(( ${snapshotCount} - ${maxSnapshotCount} ))
snapshotRemove=$(${lsCmd} -1A . | ${headCmd} -n ${snapshotRemoveCount})
${echoCmd} "Removing the ${snapshotRemoveCount} oldest snapshot(s):" >> ${dstLog}
${echoCmd} "${snapshotRemove}" >> ${dstLog}
${rmCmd} -r ${snapshotRemove} >> ${dstLog} 2>&1
else
${echoCmd} "Found ${snapshotCount} snapshot(s) where ${maxSnapshotCount} allowed. None removed."
>> ${dstLog}
fi
else
${echoCmd} "No snapshot(s) were removed." >> ${dstLog}
fi
and this editcron:
# PROVIDE: Editcron
#
# Schedule job
# Important: Always run "./editcron.sh stop" BEFORE making changes to job.
# Otherwise, the old job will remain scheduled until you restart.
#
schedule="30 2 * * *"
job="/ffp/bin/snapshot.sh"
#
# Commands
#
grepcmd="/bin/grep"
crontabcmd="/bin/crontab"
rmcmd="/bin/rm"
echocmd="/bin/echo"
#
# Tempporary files
#
TMPDIR="/tmp"
TMPCRONTXT="${TMPDIR}/crontab.txt"
TMPOTHERCRONTXT="${TMPDIR}/othercrontab.txt"
#
# FFP Start Functions
#
. /ffp/etc/ffp.subr
start_cmd="editcron_start"
stop_cmd="editcron_stop"
status_cmd="editcron_status"
editcron_start()
{
# grab existing crontab
${crontabcmd} -l > ${TMPCRONTXT}
# check if already scheduled
cronjobs=$(${grepcmd} "${job}" ${TMPCRONTXT})
if test -n "${cronjobs}"; then
${echocmd} "${job} already scheduled:"
${echocmd} "${cronjobs}"
else
# add the cron job and install the new one
${echocmd} "Scheduling ${schedule} ${job}"
${echocmd} "${schedule} ${job}" >> ${TMPCRONTXT}
${crontabcmd} ${TMPCRONTXT}
fi
# clean up
${rmcmd} ${TMPCRONTXT}
}
editcron_stop()
{
# grab existing crontab
${crontabcmd} -l > ${TMPCRONTXT}
# check if already scheduled
cronjobs=$(${grepcmd} "${job}" ${TMPCRONTXT})
if test -z "${cronjobs}"; then
${echocmd} "${job} not scheduled"
else
# remove the cron job(s) and install the new one
${grepcmd} -v "${job}" ${TMPCRONTXT} > ${TMPOTHERCRONTXT}
${crontabcmd} ${TMPOTHERCRONTXT}
${echocmd} "${job} not longer scheduled"
# clean up
${rmcmd} ${TMPOTHERCRONTXT}
fi
# clean up
${rmcmd} ${TMPCRONTXT}
}
editcron_status()
{
# grab existing crontab
${crontabcmd} -l > ${TMPCRONTXT}
cronjobs=$(${grepcmd} "${job}" ${TMPCRONTXT})
# check if already scheduled
if test -n "${cronjobs}"; then
${echocmd} "${job} is scheduled:"
${echocmd} "${cronjobs}"
else
${echocmd} "${job} not scheduled"
fi
# clean up
${rmcmd} ${TMPCRONTXT}
}
run_rc_command "$1"
AFTER the first rsync i have this log:
== /ffp/bin/rsync log start ===================================
sending incremental file list
--link-dest arg does not exist: /mnt/HD_b2/Backup_NAS/current
HD_a2/
ok but in the end did not create current ...
What should I do?
Offline
Did you check the log file? It might contain hints to what went wrong.
OK, I ran your script, and there are a a few lines broken, which cause errors. Otherwise, it works fine.
here are the lines:
${echoCmd} Executing ${rsyncCmd} ${rsyncOpts} --link-dest=${currLink} ${excludeRules} ${srcPath} ${dstPath} >> ${dstLog}
Should be:
${echoCmd} Executing ${rsyncCmd} ${rsyncOpts} --link-dest=${currLink} ${excludeRules} ${srcPath} ${dstPath} >> ${dstLog}
And
${echoCmd} "Something went wrong during backup (rc=${rsyncRC}). Current won't be updated." >> ${dstLog}
Should be:
${echoCmd} "Something went wrong during backup (rc=${rsyncRC}). Current won't be updated." >> ${dstLog}
And
${echoCmd} "Found ${snapshotCount} snapshot(s) where ${maxSnapshotCount} allowed. None removed." >> ${dstLog}
Should be
${echoCmd} "Found ${snapshotCount} snapshot(s) where ${maxSnapshotCount} allowed. None removed." >> ${dstLog}
Last edited by scaramanga (2011-09-23 10:52:33)
Offline
...and the latest version of my rsync/snapshot script can be found here: http://dns323.kood.org/forum/viewtopic. … 839#p43839
Last edited by scaramanga (2011-09-23 10:56:18)
Offline
Thanks ... At this point I put the new script, I'll try if it works better than the old.
Could you tell me where to find info for configuring the sending of emails you mention.
thanks
Offline
hom wrote:
Thanks ... At this point I put the new script, I'll try if it works better than the old.
Could you tell me where to find info for configuring the sending of emails you mention.
thanks
I didn't write a how-to. I used commands and scripts I found around here and the web.
If you can't wait and want a go at it, see here:
http://dns323.kood.org/forum/viewtopic. … 333#p30333
http://dns323.kood.org/forum/viewtopic. … 162#p32162
http://dns323.kood.org/forum/viewtopic.php?id=6578 (gmail doesn't work very reliably for me)
or just google for msmtp and mutt. That's what I use. Both tools are already on your box. No need to install any other package.
Others used emsmtp or mailx or what-not.
Offline
ok
I installed the new script and I solved for email, only thing I do not know where to put the configuration file. msmtrp so that I not be deleted on reboot fromto root directory.
I read that the firm is a problem but how can I solve 1:08
thanks
Offline
hom wrote:
ok
I installed the new script and I solved for email, only thing I do not know where to put the configuration file. msmtrp so that I not be deleted on reboot fromto root directory.
I read that the firm is a problem but how can I solve 1:08
thanks
Just place it someplace on one of the HDDs, under /mnt/hd_a2. I placed it in /mnt/HD_a2/ffp/usr/local/etc.
I launch msmtp with --file=/ffp/usr/local/etc/msmtprc
(I configured mutt with sendmail= "/usr/bin/msmtp --file=/ffp/usr/local/etc/msmtprc")
Last edited by scaramanga (2011-09-24 16:08:24)
Offline