I don't know how to edit the top of this blog.
For the moment, if you need to contact me, don't e-mail schizopanic@hotmail.com, please email IanBruntlett@hotmail.com
Hi, I'm a person living in the North East of England who has schizophrenia. I have been in and out of hospital between 2001-2004. This blog will be notes about my experiences as a patient (aka client) both in hospital and in the community. I can be contacted via email to ian DOT bruntlett AT gmail.com (delete the "DOT", "AT" and spaces from that email address). What is schizopanic? Its the panic that flashes through someone's eyes when you tell them you've got schizophrenia.
Thursday, July 30, 2015
Saturday, January 24, 2015
A bit more code
And here is the brains behind my stufftar backup (Bash) script...
# perform_backup
# $1 - stub of .tar.gz filename
# $2 - name of log file e.g. "scripts/stufftarlog.txt"
# $3 - directory to do the tarring in
# $4 onwards - files/directories to put in .tar.gz file relative to $3
function perform_backup()
{
if [ $# -lt 4 ]
then
echo "Error perform_backup() insufficient no of parameters";
return 1;
fi;
FILENAME_STUB=$1
DESTINATION_FILENAME=$1`date "+_%d_%B_%Y.tar.gz"`
LOGFILE=$2
TAR_DIR=$3
if [ $STUFFTAR_VERBOSE -gt 0 ]
then
echo $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20}
echo DESTINATION_FILENAME=$DESTINATION_FILENAME e.g. Desktop_28_December_2014.tar.gz
echo FILENAME_STUB=$FILENAME_STUB
echo LOGFILE=$LOGFILE
echo TAR_DIR=$TAR_DIR
fi
CURRENT_TIME=`date "+%H:%M:%S"`
cd $TAR_DIR
echo_and_log $LOGFILE $CURRENT_TIME Backing up key $TAR_DIR $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20}files to $DESTINATION_FILENAME
/usr/bin/time -f "%E mins:secs " tar -czf $DESTINATION_FILENAME $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20}
exit_if_failed $? "perform_backup to " $DESTINATION_FILENAME
echo File count:-
tar -tvf $DESTINATION_FILENAME | wc -l
ls -lh $DESTINATION_FILENAME
echo
cd;
return 0;
}
# perform_backup
# $1 - stub of .tar.gz filename
# $2 - name of log file e.g. "scripts/stufftarlog.txt"
# $3 - directory to do the tarring in
# $4 onwards - files/directories to put in .tar.gz file relative to $3
function perform_backup()
{
if [ $# -lt 4 ]
then
echo "Error perform_backup() insufficient no of parameters";
return 1;
fi;
FILENAME_STUB=$1
DESTINATION_FILENAME=$1`date "+_%d_%B_%Y.tar.gz"`
LOGFILE=$2
TAR_DIR=$3
if [ $STUFFTAR_VERBOSE -gt 0 ]
then
echo $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20}
echo DESTINATION_FILENAME=$DESTINATION_FILENAME e.g. Desktop_28_December_2014.tar.gz
echo FILENAME_STUB=$FILENAME_STUB
echo LOGFILE=$LOGFILE
echo TAR_DIR=$TAR_DIR
fi
CURRENT_TIME=`date "+%H:%M:%S"`
cd $TAR_DIR
echo_and_log $LOGFILE $CURRENT_TIME Backing up key $TAR_DIR $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20}files to $DESTINATION_FILENAME
/usr/bin/time -f "%E mins:secs " tar -czf $DESTINATION_FILENAME $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20}
exit_if_failed $? "perform_backup to " $DESTINATION_FILENAME
echo File count:-
tar -tvf $DESTINATION_FILENAME | wc -l
ls -lh $DESTINATION_FILENAME
echo
cd;
return 0;
}
Subscribe to:
Posts (Atom)