Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
Hi,
I have a cron job setup for rsync. But its initial run looks like its going to take a day or two because of the amount of data. I'm worried that its going to start again tonight at 2am whilst last nights is still running? Is that the case? How can I stop tonights job from starting?
Only stuff I can find by searching is how to write the script to add the cron job.. not to delete or change it..
Thanks
Batfink
Offline
One way to handle it is to write your script such that it checks to see if it is already running in memory (either directly using 'ps' or code a 'flag' file into the script). Personally, I use the flag file approach as I can easily see which scripts are active at any time.
To edit a cron job manually, just type 'crontab -e' and then manually modify the jobs. You can comment out the ones you want to skip then remove the comment ('#') later to have it run again.
Offline
Assuming your script name is "mycoolrsyncscript.sh", you can avoid multiple runs using code like this:
SCRIPTNAME="$@"
/bin/ps aux|/bin/grep $SCRIPTNAME|/bin/grep -v grep > /dev/null
RC="$?"
if [ "$RC" = "1" ]; then
exit
fi
Offline
There is some useful advice in this thread, but I personally prefer to invoke the initial rsync run interactively. Thanks to that I can notice any errors, and respond to them quickly. If you're afraid that the ssh session could get disconnected, you can always use screen.
Last edited by adambyrtek (2011-03-12 23:55:48)
Offline
Actually, since it is rsync, the best advice is to copy the files ('cp') first as it is significantly faster then rsync. Once copied, use rsync to keep the copy up to date.
Offline
Hi, thanks for the replies. I managed to figure out the -e and edited out the line. I let rsync do the initial copy (which took like 4 days!) because people had been telling me dates and times and user priviledges and stuff would be lost with cp and it confused me. All works nicely now. Its so liberating knowing if a drive fails, alls not lost!
Offline
The metadata is preserved if you use "cp -a". Anyway, I still prefer to use rsync because it shows the progress and allows me to resume the transfer if necessary.
Offline