shithub: rc

ref: f3afdf563f784c0a5703496f48c1a72dff4617f4
dir: /backup.rc/

View raw version
#!/bin/rc
# By jgstratt
# Just cd into the dir you want to backup and run. Defaults to /mnt/term/rw/. If you want to write to another location, set the "tar_dir" env veriable.

tardir='/mnt/term/rw'
backdir=`{pwd}

# Overwrite defaults with env, if they exist
if ( test -s /env/tar_dir ) {
   tardir=$tar_dir
}

# Overwrite with args, if they exist
switch($1){
case -t*
   tardir=$2
case -d*
   backdir=$2
}

date=`{date -f YYYYMMDD}
basebackdir=`{basename $backdir}
tar czf $tardir/$date.$basebackdir.tgz $backdir