SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Sponsor:

Would you like to sponsor this site?
Or buy me a beer?:


Recently Changed Pages:

View All Pages
View All Q Pages


View All Tags


Sign up for Q to post comments.





WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Terms And Conditions for Q users


Pages with comments

PageDateDiscussionTags
2017/04/20 16:35 1 Comment
2017/04/20 15:28 1 Comment
2017/04/20 15:23 1 Comment
2017/04/19 19:57 1 Comment
2017/04/19 14:59 1 Comment
2017/04/19 14:45 3 Comments
2017/04/19 14:44 1 Comment
2017/04/17 20:10 1 Comment
2017/04/17 20:07 1 Comment
2017/04/17 19:58 1 Comment
2017/04/17 19:52 1 Comment

View All Comments

slesretention

Script: Bash: Sles Retention

This is a simple retention script used on SLES. It can be easily modified to add directories for cleanup.

#!/bin/bash
########################################################################################################################
# Author : Sjoerd Hooft
# Date Initial Version: 27 Jun 2011
# Comments: sjoerd_ @ _getshifting.com
#
# Description:
# This is a default retention script for the /tmp directory on SLES linux servers.
#
# Recommendations:
# The script is designed for a 120 column terminal.
# The running user must be root.
#
# Changes:
# Please comment on your changes to the script (your name and email address, line number, description):
########################################################################################################################
 
# Script Variables
HOSTNAME_SHORT=`hostname -s`
BASEDIR=`dirname $0`
WHATAMI=`basename $0`
LOGFILE="$BASEDIR/$WHATAMI.log"
DATE=`date +%Y%m%d`
BOLD=`tput bold`
BOLDOFF=`tput sgr0`
TOMAIL=it_getshifting.com
# Send all output to logfile
exec > $LOGFILE 2>&1
 
# Retention Variables
RETENTIONTIME=+7
TMP=/tmp
 
# Start Retention
find $TMP/. -mtime ${RETENTIONTIME} -print -exec rm -rf {} \; >> $LOGFILE
 
### MAIL Results
cat $LOGFILE | mail -s "Result Retention ${HOSTNAME_SHORT}" $TOMAIL
 
### End of Script
exit 0
You could leave a comment if you were logged in.
slesretention.txt · Last modified: 2013/05/14 20:53 by sjoerd