Skip to content

Commit

Permalink
Adding cleanup script
Browse files Browse the repository at this point in the history
  • Loading branch information
rupor-github committed May 29, 2023
1 parent ed24076 commit f1c6797
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions scripts/fb2_clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

# Synology task scheduler has a problem running scripts under non-root user

if [ "$2" != "" ]; then
user_dir=`eval echo "~$2"`
if [ "${user_dir}" != "" ]; then
cd ${user_dir}
fi
fi

# -----------------------------------------------------------------------------
# Following variables could be changed
# -----------------------------------------------------------------------------

name="flibusta"

# -----------------------------------------------------------------------------
# Main body
# -----------------------------------------------------------------------------

cdate="$(date +%Y%m%d_%H%M%S)"
mydir=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)
adir="$1/${name}"
glog="${mydir}/${name}_clean_${cdate}.log"

exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3 RETURN
exec 1>${glog} 2>&1

${mydir}/libclean \
--verbose \
--destination "${adir}"

res=$?
if (( ${res} == 1 )); then
echo "LIBCLEAN error!"
exit 1
fi

0 comments on commit f1c6797

Please sign in to comment.