Requirements
- PHP 5 (tested only with 5.0.4 from Centos 4)
- php-mysql (again, only 5.0.4 from Centos 4 tested)
- FTP Server (I suggest ProFTPD w/MySQL Auth)
- Rsync and smbclient
Suggested Install Method
- mkdir /opt/generic-ftp
- cp -r bin etc log /opt/generic-ftp/
- cp generic-ftp.redhat.init /etc/init.d/generic-ftp
- mysql -u user -p -h mysql_host -e "create database generic_ftp;"
- mysql -u user -p -h mysql_host -e "create database generic_ftp_backup;"
- mysql -u user -p -h mysql_host generic_ftp < generic_ftp.mysql
- mysql -u user -p -h mysql_host generic_ftp_backup < generic_ftp_backup.mysql
- mysql -u user -p -h mysql_host
- Set up grants for generic-ftp to access your db
Configuration
- vim /opt/generic-ftp/etc/generic-ftp.ini
[global]
xml_config = /opt/generic-ftp/etc/config.xml (path to the config.xml file)
actions_dir = /opt/generic-ftp/bin/actions (path to the dir with custom actions in it)
db_host = db_host (FQDN of your mysql host)
db_user = db_user (mysql user)
db_pass = db_pass (mysql pass)
db_db = generic_ftp (mysql database)
lock_host = db_lock_host (mysql lock host)
lock_user = db_lock_user (mysql lock user)
lock_pass = db_lock_pass (mysql lock pass)
lock_db = generic_ftp_backup (mysql lock database)
log_file = /opt/generic-ftp/log/generic_ftp.log (path to generic ftp log file)
log_level = INFO (log level: ERROR, WARN, INFO, DEBUG, SQLDEBUG)
[queuer]
ftp_root = /opt/ftp/root (ROOT of your ftp server)
processing_dir = /opt/ftp/processing (Temp dir for holding files being processed)
[processor]
max_childs = 5 (Maximum number of simultaneous actions that can run)
[archiver]
archive_dir = /opt/ftp/archive (Directory to store archive copy after actions finished)
days_to_keep = 30 (Days to keep archived files before purging them)
[backup]
rsync_options = "--exclude .in.* --archive --delete"
rsync_server = backup_server_hostname
rsync_mount_point = rsync_target
config_dir = /opt/generic-ftp/etc
[daemon] (Time in minutes between running each part. 0 disables that part)
queuer_interval = 5
processor_interval = 5
archiver_interval = 10
backup_interval = 0
config.xml
Configuration is recursive. If you set an action to the ftp root (/opt/ftp/root) and create a user with a homedir of /opt/ftp/root/someuser1, unless you configure a specific action on /opt/ftp/root/someuser1, generic-ftp will keep going up 1 dir at a time until it finds an action or reaches the ftp root.
<ftpconfig>
<directory dir="/opt/ftp/root/">
<action type='hold'>
<options>7</options>
</action>
</directory>
<directory dir="/opt/ftp/root/someuser1">
<action type='rsync'>
<options>--server rsyncserver --target rsynctarget --directory directoryofftarget</options>
<retries>3</retries>
</action>
</directory>
</ftpconfig>With this set up, all files uploaded to all directories other than /opt/ftp/root/someuser1 will be held for 7 days. Anything uplaoded to /home/ftp/root/someuser1 will be rsynced to rsynctarget/rsyncdirectory on rsyncserver.
After modifying config.xml, you must save it to the database: /opt/generic-ftp/bin/config.php --save-to-db
Control
- /etc/init.d/generic-ftp
- start/stop (obvious)
- reload (reread generic-ftp.ini. really only for changing intervals)
- doqueue (force a run of the queue processor