I've got a quick logic question. I'm pretty savvy when it comes to shell scripting, however, I'm at a loss when it comes to writing a simple shell script to backup only certain files out of the month. I have a directory, for example, /data/backups/websites/domain. In each "domain" directory, there are files that are named by the date of when they were created, for example:
The string is: domain-year-month-day.tar.gz
All I'm wanting to do is backup one file per week, and create a monthly backup (about 4 backups per month). Maybe I should change the string creation to a "day" and just backup "sun" (sunday) for that current month and then backup the backups - that might work. However, I am wanting to run a backup everyday, then at the end of the month, backup the 4 (sometimes just 3) backups of that month and create a monthly backup. The reason being that if I need a daily backup during the month I have it, but after that month is over, I should (maybe) only need a weekly backup.
This is how I want my system to be, and just needed some insight on how to actually get the individual (3 or 4 backups per month) to work. I already have it down how to create the backups and such, but taking what is currently being backed up (30 or 31 backups), and then at the end of the month, do the weekly backups (the part I'm wanting help with).
If anyone has any code snippets or just a few lines of "this could work" or "try this", I'd be very grateful.
Hi All,
hope you all are doing well!
I kindly ask you for shell scripting help, here is the description:
I have huge number of files shown below on date wise, which contains different strings(numbers you can say) including 505001 and 602001.
... (14 Replies)
Hi All,
I need to find all files other than first two files dates & last file date for month and month/year wise list.
lets say there are following files in directory
Mar 19 2012 c.txt
Mar 19 2012 cc.txt
Mar 21 2012 d.txt
Mar 22 2012 f.txt
Mar 24 2012 h.txt
Mar 25 2012 w.txt
Feb 12... (2 Replies)
Hi All,
I am new to shell srcipting.
Problem :
I need to write a script which copy the log files from /prod/logs directory based on todays date like (Jul 17) and place it to /home/hzjnr0 directory and then search the copied logfiles for the string "@ending successfully on Thu Jul 17". If... (2 Replies)
Hello,
I was wondering if anyone knows a faster way to search and compare strings and dates from 2 files?
I'm currently using "for loop" but seems sluggish as i have to cycle through 10 directories with 10 files each containing thousands of lines.
Given:
-10 directories
-10 files... (4 Replies)
I have a requirement where I need to move files that are being written too. I am unable to use sed since I believe this will stop the files from getting written. There is a directory containing about 50 unique files, the date is the same on all of them.
I need to change the date string on each... (1 Reply)
Hi,
I have below two situations to handle,
1. I have list of files with file names having date&time. I have to backup to old date files. say I have below files in a directory,
1. XX123_20101004010101.dat
2. XX124_20101004010201.dat
3. XX121_20101003010101.dat
4.... (6 Replies)
1. The problem statement, all variables and given/known data:
I have standard web server log file. It contains different columns (like IP address, request result code, request type etc) including a date column with the format .
I have developed a log analysis command line utility that displays... (1 Reply)
:confused: I'm not really sure about the default backup date & time in our Unix system and I would like to change it to a convienient time...how do I do that? Please help? (1 Reply)