01-08-2010
How to automatically delete old backups
I'm creating nightly backups using cygwin bash with this one line script:
zip -r "K:/backup/outlook/`date "+%y%m%d%M"`" C:/Documents\ and\ Settings/siegfried/Local\ Settings/Application\ Data/Microsoft/Outlook
How can I enhance my script using the "rm" command so I never have more than 4 zip files and the oldest is deleted?
I could use the cygwin bash "find" command to delete files older than four days, but this is not what I want (what if I miss doing backup one day or several days? I would not want to loose all my backups if I failed to do it regularly).
Also, is there any way to write a bash script that will kill the outlook process that locks these files? Hmmm... that may be more of a windows question that is more appropriate for a different forum...
Thanks,
Siegfried
Thanks,
siegfried
9 More Discussions You Might Find Interesting
1. Filesystems, Disks and Memory
I have been using the hostdump.sh backup script for over a year now and have recently run into a problem. I'm now getting the following error at the end of my jobs;
/bin/mt -f: error fsf'ing tape.
This script uses the native 'ufsdump'. So, I try to go back and read the last dump on the tape... (11 Replies)
Discussion started by: Solaris
11 Replies
2. UNIX for Dummies Questions & Answers
When using hostdump.sh to backup a system I can do it fine. But how can I restore what I backuped up?
:)
Thx in advance (2 Replies)
Discussion started by: merlin
2 Replies
3. UNIX for Dummies Questions & Answers
Hello everyone my ? is about backups. I'am running SCO OS 505 and currently backing up the hole HD. Well the back up is taking too long and this is becoming a problem for the users since we are a 24-7 bussines, I whant stop backing up every thing on the HD. What are the most important files and... (1 Reply)
Discussion started by: kikkin
1 Replies
4. UNIX for Advanced & Expert Users
Hi, how i can do background backup process in Unix??
I has Solaris Operating System.
very much thanks!! (4 Replies)
Discussion started by: jairog
4 Replies
5. UNIX Desktop Questions & Answers
I've been handed the task of backing up some of our system files on a Solaris box. No probs. Zipped the logs that needed backing up but my superiors do not want it on tape, they want it spanned on CD's. The CD-Writer is available on a MS box. FTP'd the zipped logs across too the MS Machine but now... (1 Reply)
Discussion started by: mccrack_2003
1 Replies
6. Shell Programming and Scripting
I have to write a shell script like this--
1) Utility will be run under the directory owner.
2) This utility will clean files in ABC/logs. And following logs will be backed up or deleted.
Dispatcher Logs
Middle tier Logs
Sage log
Sage monitor log
Sage db clean up result log
Core files ... (12 Replies)
Discussion started by: namishtiwari
12 Replies
7. Shell Programming and Scripting
We need to su to root in 1000 systems, so it is almost impossible to add "stty erase ^H" to every .profile on these systems.
Is there any way to set delete key to erase automatically after running "su -"?
Thanks :) (4 Replies)
Discussion started by: aixlover
4 Replies
8. UNIX and Linux Applications
Is there a way to backup an Oracle 9i database without the use of OEM and OMS? (1 Reply)
Discussion started by: adelsin
1 Replies
9. Shell Programming and Scripting
Here is the script I want to run to deleted log files after a certain time:
touch /usr/WebSphere/AppServer/profiles/AppSrv01/apps/RSA/logs
find /usr/WebSphere/AppServer/profiles/AppSrv01/apps/RSA/logs -atime +120 - exec rm -rf {}\;
Exerytime I run it, it throws me the error:
find: paths must... (2 Replies)
Discussion started by: lennyz04
2 Replies
RBASH(1) General Commands Manual RBASH(1)
NAME
rbash - restricted bash, see bash(1)
RESTRICTED SHELL
If bash is started with the name rbash, or the -r option is supplied at invocation, the shell becomes restricted. A restricted shell is
used to set up an environment more controlled than the standard shell. It behaves identically to bash with the exception that the follow-
ing are disallowed or not performed:
o changing directories with cd
o setting or unsetting the values of SHELL, PATH, ENV, or BASH_ENV
o specifying command names containing /
o specifying a file name containing a / as an argument to the . builtin command
o specifying a filename containing a slash as an argument to the -p option to the hash builtin command
o importing function definitions from the shell environment at startup
o parsing the value of SHELLOPTS from the shell environment at startup
o redirecting output using the >, >|, <>, >&, &>, and >> redirection operators
o using the exec builtin command to replace the shell with another command
o adding or deleting builtin commands with the -f and -d options to the enable builtin command
o using the enable builtin command to enable disabled shell builtins
o specifying the -p option to the command builtin command
o turning off restricted mode with set +r or set +o restricted.
These restrictions are enforced after any startup files are read.
When a command that is found to be a shell script is executed, rbash turns off any restrictions in the shell spawned to execute the script.
SEE ALSO
bash(1)
GNU Bash-4.0 2004 Apr 20 RBASH(1)