crazy-max / docker-pure-ftpd

Pure-FTPd Docker image based on Alpine Linux with MySQL, PostgreSQL and LDAP support
MIT License
56 stars 15 forks source link

Environment variable UPLOADSCRIPT not work #36

Closed evlash closed 3 years ago

evlash commented 3 years ago

Behaviour

When set environment variables UPLOADSCRIPT=/data/uploadscript.sh after file upload script not run

Steps to reproduce this issue

  1. set environment variables UPLOADSCRIPT=/data/uploadscript.sh
    
    version: "3.2"

services: ftpd: image: ghcr.io/crazy-max/pure-ftpd:1.0.49 container_name: ftpd ports:

  1. uploadscript.sh content is:
    #!/bin/sh
    echo "$1 has been uploaded" >> /tmp/ftp.log

pureftpd.flags content is:

-d
-d
--tls 1
-O w3c:/var/log/pureftpd.log
  1. docker-compse up

Actual behaviour

  1. Starting log

    [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
    [s6-init] ensuring user provided files have correct perms...exited 0.
    [fix-attrs.d] applying ownership & permissions fixes...
    [fix-attrs.d] done.
    [cont-init.d] executing container initialization scripts...
    [cont-init.d] 01-config.sh: executing... 
    Setting timezone to Europe/Kiev...
    ln: /etc/localtime: File exists
    /var/run/s6/etc/cont-init.d/01-config.sh: line 61: can't create /etc/timezone: Read-only file system
    Use MySQL authentication method
    Waiting 45s for MySQL database to be ready...
    MySQL database ready!
    Flags
    Secure: --maxclientsnumber 5 --maxclientsperip 5 --antiwarez --customerproof --dontresolve --norename --prohibitdotfilesread --prohibitdotfileswrite
    Additional: -d -d --tls 1 -O w3c:/var/log/pureftpd.log
    All: -d -d --tls 1 -O w3c:/var/log/pureftpd.log --bind 0.0.0.0,2100 --ipv4only --passiveportrange 30000:30009 --noanonymous --createhomedir --nochmod --syslogfacility ftp --forcepassiveip xx.xx.xx.xx --maxclientsnumber 5 --maxclientsperip 5 --antiwarez --customerproof --dontresolve --norename --prohibitdotfilesread --prohibitdotfileswrite --login mysql:/data/pureftpd-mysql.conf --uploadscript
    [cont-init.d] 01-config.sh: exited 0.
    [cont-init.d] 02-service.sh: executing... 
    [cont-init.d] 02-service.sh: exited 0.
    [cont-init.d] 03-uploadscript.sh: executing... 
    [cont-init.d] 03-uploadscript.sh: exited 0.
    [cont-init.d] ~-socklog: executing... 
    [cont-init.d] ~-socklog: exited 0.
    [cont-init.d] done.
    [services.d] starting services
    [services.d] done.
  2. using FileZilla to longin and put a file

    11:34:13    Status: Connecting to xx.xx.xx.xx:2100...
    11:34:13    Status: Connection established, waiting for welcome message...
    11:34:13    Status: Initializing TLS...
    11:34:14    Status: Verifying certificate...
    11:34:14    Status: TLS connection established.
    11:34:14    Status: Logged in
    11:34:14    Status: Starting upload of /home/edv/Downloads/Telegram Desktop/rest_36971_20201224120001.zip
    11:34:14    Status: File transfer successful, transferred 277 012 bytes in 1 second
    11:34:14    Status: Retrieving directory listing of "/home/user-dir/test"...
    11:34:15    Status: Directory listing of "/home/user-dir/test" successful
  3. list of process on container.

    /data # ps
    PID   USER     TIME  COMMAND
    1 root      0:00 s6-svscan -t0 /var/run/s6/services
    35 root      0:00 s6-supervise s6-fdholderd
    600 root      0:00 s6-supervise socklog/log
    601 root      0:00 s6-supervise socklog
    602 root      0:00 s6-supervise pure-ftpd
    603 root      0:00 s6-supervise pure-uploadscript
    605 root      0:00 pure-ftpd (SERVER)
    606 nobody    0:00 s6-log -b - +^cron. T /var/log/socklog/cron - +^daemon. T /var/log/socklog/daemon
    607 nobody    0:00 socklog unix /dev/log
    608 root      0:00 pure-uploadscript -p /var/run/pure-uploadscript.pid -r /data/uploadscript.sh
    639 root      0:00 sh
    653 root      0:00 pure-uploadscript -p /var/run/pure-uploadscript.pid -r /data/uploadscript.sh
    655 root      0:00 pure-uploadscript -r /data/uploadscript.sh
    659 1003      0:00 pure-ftpd (IDLE)
    660 root      0:00 pure-ftpd (PRIV)
    664 root      0:00 sh
    671 root      0:00 sh
    677 root      0:00 ps
    /data #
  4. /var/log/pureftpd.log

    2021-04-05 08:35:43 xx.xx.xx.xx []created /home/user-dir/test/rest_36971_20201224120001.zip 226 test 277012
  5. But script not run

    /data # cat /tmp/ftp.log
    cat: can't open '/tmp/ftp.log': No such file or directory
  6. If run script manually, it's work

    /data # sh uploadscript.sh test
    /data # cat /tmp/ftp.log
    test has been uploaded
    /data # 
stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.