-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart_samba.sh
More file actions
executable file
·44 lines (35 loc) · 956 Bytes
/
start_samba.sh
File metadata and controls
executable file
·44 lines (35 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
echo "Starting Samba container..."
# Get host user ID from environment or use default
HOST_UID=${HOST_UID:-1000}
HOST_GID=${HOST_GID:-1000}
echo "Using HOST_UID=$HOST_UID and HOST_GID=$HOST_GID"
# Initialize users
/init_users.sh
# Create log directory
mkdir -p /var/log/samba
# Test Samba configuration
testparm -s
# Start Samba services
echo "Starting nmbd..."
nmbd -D
echo "Starting smbd..."
smbd -D
# Keep container running and show logs
echo "Samba server is running..."
# Wait for log files to be created, then tail them
sleep 2
if ls /var/log/samba/*.log 1> /dev/null 2>&1; then
tail -f /var/log/samba/*.log
else
echo "No log files found yet, monitoring..."
# Keep container alive
while true; do
sleep 60
if ls /var/log/samba/*.log 1> /dev/null 2>&1; then
echo "Log files found, starting to monitor..."
tail -f /var/log/samba/*.log
break
fi
done
fi