Created
October 1, 2012 12:03
-
-
Save bobmurder/3811213 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#cron job | |
#*/5 * * * /path/to/script | |
RCFILE_ARCHIVE=/path/to/rcfile/gzip | |
MORGUE_ARCHIVE=/path/to/morgue/gzip | |
# base is the parent directory of rcfiles/ or morgue/ | |
# files is a newline separated list of rcfiles/neil.rc or morgue/neil.txt files | |
rc_base=$(find $(pwd) -name 'rcfiles' -type d | sed 's/rcfiles$//') | |
morgue_base=$(find $(pwd) -name 'morgue' -type d | sed 's/morgue$//') | |
rc_files=$(find $rc_base -name '*.rc' -type f | sed 's/^.*rcfiles/rcfiles/') | |
morgue_files=$(find $morgue_base -name '*.txt' -type f | sed 's/^.*morgue/morgue/') | |
if [[ -f $RCFILE_ARCHIVE && -f $MORGUE_ARCHIVE ]] | |
then | |
xargs tar czf $RCFILE_ARCHIVE/rcfiles.tar.gz -C $rc_base $rc_files; | |
xargs tar czf $MORGUE_ARCHIVE/morgues.tar.gz -C $morgue_base $morgue_files; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment