diff --git a/Dockerfile b/Dockerfile index cf98de3..5fa4fe1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,6 @@ COPY samba.sh /usr/bin/ VOLUME ["/etc/samba"] -EXPOSE 139 445 +EXPOSE 137 139 445 ENTRYPOINT ["samba.sh"] \ No newline at end of file diff --git a/README.md b/README.md index 62d53cf..fe151ad 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ OR set local storage: -h This help -i "" Import smbpassword required arg: "" - full file path in container + -n Start the 'nmbd' daemon to advertise the shares -s "[;browsable;readonly;guest;users]" Configure a share required arg: ";;" is how it's called for clients @@ -53,6 +54,7 @@ OR set local storage: ENVIRONMENT VARIABLES (only available with `docker run`) + * `NMBD` - As above, enable nmbd * `TZ` - As above, set a zoneinfo timezone, IE `EST5EDT` ## Examples diff --git a/samba.sh b/samba.sh index 0d82535..5363256 100755 --- a/samba.sh +++ b/samba.sh @@ -92,6 +92,7 @@ Options (fields in '[]' are optional, '<>' are required): -h This help -i \"\" Import smbpassword required arg: \"\" - full file path in container + -n Start the 'nmbd' daemon to advertise the shares -s \"[;browsable;readonly;guest;users]\" Configure a share required arg: \";;\" is how it's called for clients @@ -114,10 +115,11 @@ The 'command' (if provided and valid) will be run instead of samba exit $RC } -while getopts ":hi:t:u:s:" opt; do +while getopts ":hi:nt:u:s:" opt; do case "$opt" in h) usage ;; i) import "$OPTARG" ;; + n) NMBD="true" ;; s) eval share $(sed 's/^\|$/"/g; s/;/" "/g' <<< $OPTARG) ;; u) eval user $(sed 's/;/ /g' <<< $OPTARG) ;; t) timezone "$OPTARG" ;; @@ -137,5 +139,6 @@ elif [[ $# -ge 1 ]]; then elif ps -ef | egrep -v grep | grep -q smbd; then echo "Service already running, please restart container to apply changes" else + [[ $NMBD ]] && ionice -c 3 nmbd -DS exec ionice -c 3 smbd -FS fi \ No newline at end of file