Compare commits
2 Commits
246ed4febf
...
0d7c6e48bc
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d7c6e48bc | |||
| 37aef5a70d |
@ -32,6 +32,22 @@ log_collision() {
|
||||
echo "[$(timestamp)] [SKIP] Collision: $1" >> "$LOG_FILE"
|
||||
}
|
||||
|
||||
get_dir_diagnostics() {
|
||||
local DIR="$1"
|
||||
|
||||
local DIR_STAT
|
||||
DIR_STAT=$(stat -c 'inode=%i uid=%u gid=%g perms=%a owner=%U group=%G' "$DIR" 2>/dev/null)
|
||||
|
||||
cat <<EOF
|
||||
dir_stat='$DIR_STAT'
|
||||
|
||||
current_user='$(id -un)'
|
||||
current_group='$(id -gn)'
|
||||
current_uid='$(id -u)'
|
||||
current_gid='$(id -g)'
|
||||
EOF
|
||||
}
|
||||
|
||||
# Логируем новую задачу
|
||||
log_info "----------------------------------------------"
|
||||
log_info "Torrent: $1"
|
||||
@ -190,7 +206,16 @@ if [[ $2 == 'Anime' ]]; then
|
||||
INFO_TXT="$TARGET_DIR/info.txt"
|
||||
|
||||
if [ ! -d "$TARGET_DIR" ]; then
|
||||
mkdir -p "$TARGET_DIR"
|
||||
if ! mkdir -p "$TARGET_DIR"; then
|
||||
|
||||
log_error "Failed to create target directory
|
||||
|
||||
Path='$TARGET_DIR'
|
||||
$(get_dir_diagnostics "$TARGET_DIR")"
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "=== Anime Info: $TITLE ===" > "$INFO_TXT"
|
||||
fi
|
||||
|
||||
@ -198,18 +223,11 @@ if [[ $2 == 'Anime' ]]; then
|
||||
|
||||
if [ ! -w "$TARGET_DIR" ]; then
|
||||
|
||||
DST_DIR_STAT=$(stat -c 'inode=%i uid=%u gid=%g perms=%a owner=%U group=%G' "$TARGET_DIR" 2>/dev/null)
|
||||
|
||||
log_error "Target directory is not writable
|
||||
|
||||
Source='$FILE_PATH'
|
||||
Target='$TARGET_FILE'
|
||||
target_dir_stat='$DST_DIR_STAT'
|
||||
|
||||
current_user='$(id -un)'
|
||||
current_group='$(id -gn)'
|
||||
current_uid='$(id -u)'
|
||||
current_gid='$(id -g)'"
|
||||
$(get_dir_diagnostics "$TARGET_DIR")"
|
||||
|
||||
continue
|
||||
fi
|
||||
@ -235,7 +253,6 @@ current_gid='$(id -g)'"
|
||||
LN_ERROR=$(cat "$TMP_ERR" 2>/dev/null)
|
||||
|
||||
SRC_STAT=$(stat -c 'inode=%i uid=%u gid=%g perms=%a owner=%U group=%G' "$FILE_PATH" 2>/dev/null)
|
||||
DST_DIR_STAT=$(stat -c 'inode=%i uid=%u gid=%g perms=%a owner=%U group=%G' "$TARGET_DIR" 2>/dev/null)
|
||||
|
||||
log_error "Link failed for '$FINAL_FILENAME'
|
||||
|
||||
@ -245,12 +262,8 @@ Target='$TARGET_FILE'
|
||||
ln_error='$LN_ERROR'
|
||||
|
||||
source_stat='$SRC_STAT'
|
||||
target_dir_stat='$DST_DIR_STAT'
|
||||
|
||||
current_user='$(id -un)'
|
||||
current_group='$(id -gn)'
|
||||
current_uid='$(id -u)'
|
||||
current_gid='$(id -g)'"
|
||||
$(get_dir_diagnostics "$TARGET_DIR")"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user