krungkuene.org

back
to please me link this page
or look at my newest art stuff on my site --->
freedom fight for creativity
krung's knowledge pages

seite in deutsch

backup a file, add date and editors name

published:  2003-08-25

related pages: more shell scripts

make backup !


if you manipulate a config file, here i used httpd.conf, make a backup before.

because i run my server with kuene, it is important to know the editor who 
made changes to the config file.


download


backup_httpd.sh
backup_httpd.sh.gz


#!/bin/bash

# V 0.1.0 021205 backup_httpd.sh
#
# Licensed under GPL
#
#  ¢  ¢
#  ¢ ¢
#  ¢     ¢¢  ¢  ¢  ¢¢   ¢¢     ¢¢   ¢¢   ¢¢
#  ¢ ¢  ¢  ¢ ¢  ¢ ¢  ¢ ¢  ¢   ¢  ¢ ¢  ¢ ¢  ¢
#  ¢  ¢ ¢     ¢¢  ¢  ¢  ¢¢¢ ¢  ¢¢  ¢     ¢¢¢
#                         ¢                ¢
#        martin         ¢¢     krung     ¢¢
#
# ++++++++++++++++++++++++++++++++++++++++++++++++
#

#  DESC
#   
#  makes a backup of the httpd.conf file, 
# 
#  add the editors name, and compress it.
#
#  REQUIRE
#
#  date,gzip


FILE=httpd.conf

echo "makes backup of $FILE"

# reads STDIN
IFS=:
echo "your name ?"
read NAME

# get date & time
DATUM=`date "+%y%m%d"`
TIME=`date "+%H%M"`

# cp
echo "copies $FILE to ${DATUM}_${TIME}_${NAME}_httpd.conf"
cp $FILE ${DATUM}_${TIME}_${NAME}_$FILE
echo "cp worked"

# gzip
echo "ziped ${DATUM}_${TIME}_$FILE to ${DATUM}_${TIME}_${NAME}_$FILE.gz"
gzip -9 ${DATUM}_${TIME}_${NAME}_$FILE
echo "gzip worked"


Valid HTML 4.01! nano text editor Creative Commons License