* sync: verbose mode added..
This commit is contained in:
parent
99ac67a04a
commit
e9330d5bc4
25
sync
25
sync
|
@ -9,6 +9,7 @@ PLANET_DIR="${HOME}/public_html/gezegen"
|
|||
LOG_DIR="$PLANET_DIR/logs"
|
||||
LOG_FILE="planet-$(date +"%d.%m.%Y").log"
|
||||
LOCK_FILE="planet-sync.lck"
|
||||
VERBOSE=0
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
|
@ -18,6 +19,7 @@ Options:
|
|||
-h, --help this help
|
||||
-p, --planetdir useful if the planet dir is somewhere else than the
|
||||
default one
|
||||
-v, --verbose print the log instead of writing it to the log file..
|
||||
|
||||
Usage: $(basename $0) [--help] [--planetdir /path/to/planet]
|
||||
EOF
|
||||
|
@ -46,6 +48,11 @@ while (( $# > 0 )); do
|
|||
shift 2
|
||||
;;
|
||||
|
||||
--verbose|-v)
|
||||
VERBOSE=1
|
||||
shift
|
||||
;;
|
||||
|
||||
-*)
|
||||
usage
|
||||
exit 1
|
||||
|
@ -74,11 +81,19 @@ if [[ -f "$PLANET_DIR/$LOCK_FILE" ]]; then
|
|||
exit 1
|
||||
else
|
||||
touch "$PLANET_DIR/$LOCK_FILE"
|
||||
echo >> "$LOG_DIR/$LOG_FILE" 2>&1
|
||||
echo "starting new sync ($(date +"%d.%m.%Y, %H:%M"))" >> "$LOG_DIR/$LOG_FILE" 2>&1
|
||||
echo "-----------------------------------------------------------" >> "$LOG_DIR/$LOG_FILE" 2>&1
|
||||
"$PLANET_DIR/planet.py" "$PLANET_DIR/gezegen/config.ini" >> "$LOG_DIR/$LOG_FILE" 2>&1
|
||||
echo "-----------------------------------------------------------" >> "$LOG_DIR/$LOG_FILE" 2>&1
|
||||
if (( $VERBOSE == 0 )); then
|
||||
echo >> "$LOG_DIR/$LOG_FILE" 2>&1
|
||||
echo "starting new sync ($(date +"%d.%m.%Y, %H:%M"))" >> "$LOG_DIR/$LOG_FILE" 2>&1
|
||||
echo "-----------------------------------------------------------" >> "$LOG_DIR/$LOG_FILE" 2>&1
|
||||
"$PLANET_DIR/planet.py" "$PLANET_DIR/gezegen/config.ini" >> "$LOG_DIR/$LOG_FILE" 2>&1
|
||||
echo "-----------------------------------------------------------" >> "$LOG_DIR/$LOG_FILE" 2>&1
|
||||
else
|
||||
echo
|
||||
echo "starting new sync ($(date +"%d.%m.%Y, %H:%M"))"
|
||||
echo "-----------------------------------------------------------"
|
||||
"$PLANET_DIR/planet.py" "$PLANET_DIR/gezegen/config.ini"
|
||||
echo "-----------------------------------------------------------"
|
||||
fi
|
||||
fi
|
||||
|
||||
# if ended successfully delete the lock file
|
||||
|
|
Loading…
Reference in New Issue
Block a user