mirror of
https://github.com/dockur/windows.git
synced 2025-10-27 11:25:49 +00:00
feat: Improved Samba logging
This commit is contained in:
parent
5659082f99
commit
a305488cf6
1 changed files with 24 additions and 21 deletions
45
src/samba.sh
45
src/samba.sh
|
|
@ -118,51 +118,54 @@ for dir in "${dirs[@]}"; do
|
||||||
addShare "$dir" "$dir_name" "Shared $dir_name" || error "Failed to create shared folder for $dir!"
|
addShare "$dir" "$dir_name" "Shared $dir_name" || error "Failed to create shared folder for $dir!"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Try to fix Samba permissions
|
# Try to repair Samba permissions
|
||||||
[ -d /run/samba/msg.lock ] && chmod -R 0755 /run/samba/msg.lock 2>/dev/null || :
|
[ -d /run/samba/msg.lock ] && chmod -R 0755 /run/samba/msg.lock 2>/dev/null || :
|
||||||
[ -d /var/log/samba/cores ] && chmod -R 0700 /var/log/samba/cores 2>/dev/null || :
|
[ -d /var/log/samba/cores ] && chmod -R 0700 /var/log/samba/cores 2>/dev/null || :
|
||||||
[ -d /var/cache/samba/msg.lock ] && chmod -R 0755 /var/cache/samba/msg.lock 2>/dev/null || :
|
[ -d /var/cache/samba/msg.lock ] && chmod -R 0755 /var/cache/samba/msg.lock 2>/dev/null || :
|
||||||
|
|
||||||
if [[ "$SAMBA_DEBUG" != [Yy1]* ]]; then
|
rm -f /var/log/samba/log.smbd
|
||||||
if ! smbd; then
|
|
||||||
SAMBA_DEBUG="Y"
|
if ! smbd -l /var/log/samba; then
|
||||||
error "Samba daemon failed to start!"
|
SAMBA_DEBUG="Y"
|
||||||
fi
|
error "Failed to start Samba daemon!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$SAMBA_DEBUG" == [Yy1]* ]]; then
|
if [[ "$SAMBA_DEBUG" == [Yy1]* ]]; then
|
||||||
smbd -i -d "$SAMBA_LEVEL" --debug-stdout &
|
tail -fn +0 /var/log/samba/log.smbd &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ "${NETWORK,,}" == "user"* ]] && return 0
|
|
||||||
|
|
||||||
if [[ "${BOOT_MODE:-}" == "windows_legacy" ]]; then
|
if [[ "${BOOT_MODE:-}" == "windows_legacy" ]]; then
|
||||||
|
|
||||||
# Enable NetBIOS on Windows 7 and lower
|
# Enable NetBIOS on Windows 7 and lower
|
||||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Starting NetBIOS daemon..."
|
[[ "$DEBUG" == [Yy1]* ]] && echo "Starting NetBIOS daemon..."
|
||||||
|
|
||||||
if [[ "$SAMBA_DEBUG" != [Yy1]* ]]; then
|
rm -f /var/log/samba/log.nmbd
|
||||||
if ! nmbd; then
|
|
||||||
SAMBA_DEBUG="Y"
|
if ! nmbd -l /var/log/samba; then
|
||||||
error "NetBIOS daemon failed to start!"
|
SAMBA_DEBUG="Y"
|
||||||
fi
|
error "Failed to start NetBIOS daemon!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$SAMBA_DEBUG" == [Yy1]* ]]; then
|
if [[ "$SAMBA_DEBUG" == [Yy1]* ]]; then
|
||||||
nmbd -i -d "$SAMBA_LEVEL" --debug-stdout &
|
tail -fn +0 /var/log/samba/log.nmbd &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
# Enable Web Service Discovery on Vista and up
|
# Enable Web Service Discovery on Vista and up
|
||||||
[[ "$DEBUG" == [Yy1]* ]] && echo "Starting Web Service Discovery daemon..."
|
[[ "$DEBUG" == [Yy1]* ]] && echo "Starting Web Service Discovery daemon..."
|
||||||
|
|
||||||
if [[ "$SAMBA_DEBUG" != [Yy1]* ]]; then
|
rm -f /var/log/wsddn.log
|
||||||
wsddn -i "$interface" -H "$hostname" --unixd --pid-file=/var/run/wsdd.pid
|
|
||||||
else
|
if ! wsddn -i "$interface" -H "$hostname" --unixd --log-file=/var/log/wsddn.log --pid-file=/var/run/wsdd.pid; then
|
||||||
wsddn -i "$interface" -H "$hostname" --pid-file=/var/run/wsdd.pid &
|
SAMBA_DEBUG="Y"
|
||||||
|
error "Failed to start WSDDN daemon!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "$SAMBA_DEBUG" == [Yy1]* ]]; then
|
||||||
|
tail -fn +0 /var/log/wsddn.log &
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue