mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-19 11:42:43 +00:00
move debian scripts here
This commit is contained in:
parent
964e22659a
commit
1dc46a67a7
30
debian.sh
Executable file
30
debian.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
set -o pipefail
|
||||
set -u
|
||||
|
||||
export LOGNAME=tunasync
|
||||
FTPSYNC="${FTPSYNC:-"ftpsync"}"
|
||||
FTPSYNC_LOG_DIR="${FTPSYNC_LOG_DIR:-"/var/log/ftpsync"}"
|
||||
|
||||
trap 'kill $(jobs -p)' EXIT
|
||||
|
||||
if [[ $1 == sync:archive:* ]]; then
|
||||
${FTPSYNC} $1 &
|
||||
PID=$!
|
||||
jobname=${1##sync:archive:}
|
||||
jobname=${jobname//\/}
|
||||
jobname=${jobname//.}
|
||||
sleep 2
|
||||
if [[ ! -f ${FTPSYNC_LOG_DIR}/ftpsync-${jobname}.log ]]; then
|
||||
echo "Failed to start ftpsync, please check configuration file."
|
||||
exit 1
|
||||
fi
|
||||
tail --retry -f "${FTPSYNC_LOG_DIR}/ftpsync-${jobname}.log" &
|
||||
tail --retry -f "${FTPSYNC_LOG_DIR}/rsync-ftpsync-${jobname}.log" &
|
||||
tail --retry -f "${FTPSYNC_LOG_DIR}/rsync-ftpsync-${jobname}.error" &
|
||||
wait $PID
|
||||
else
|
||||
echo "Invalid command line"
|
||||
exit 1
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user