Automate multi-server FTP/SFTP file uploads and text file editing for Source dedicated servers
- Add files to upload folder according to folder structure seen after login, e.g.
/tf. New folders will automatically be created. - Fill
ftp_loginswith ftp/sftp login and rcon information for the servers. See the file for examples of the required fields. - Edit
ftp_upload_runto define list of servers to upload to, along with optional rcon commands (Sourcemod plugins will automatically be loaded/reloaded) - Set
force_reuploadtoTrueto ignore file size check and upload anyway. (Useful when the file size has not changed since we can only compare files by size in FTP) - Include the full path to the file for
deletelist of file deletions, e.g./tf/addons/sourcemod/plugins/myplugin.smx - Plugin deletions are not automatically unloaded. You will have to set
rconwith a command likesm plugins unload myplugin. - Execute
python ftp_upload_run
- Fill
ftp_loginswith ftp/sftp login and rcon information for the servers. See the file for examples of the required fields. - Edit
ftp_edit_runto define list of servers to connect to, along with optional rcon commands - Add to
editsthe list of sequential operations to run on each server. - Operations can be chained in the event of failure. (See the Replace with Insert failover example.)
- Set
read_onlytoTruefor a dry run without uploading changes. - Set
backuptoTrueto enable backup of files prior to uploading changes (or a Backup operation). These are sorted per server folder inbackups/<date>-<time>/<server>. - Set
max_backupsto the number of backups to keep. Each run that writes at least one backup file counts as one backup.
Command- Send one or more rcon commands to the serverBackup- Create a backup of the specifiedfile.backupvariable at the bottom must be set toTruePrint- Dump the contents of the text file to console.Sort- Sorts the lines in the text file alphabetically (without blank lines).Find- Search the text file with regexsearchFindDuplicates- Search the text file with regexsearchand remove subsequent lines with duplicate matches.Insert- Insert a line into the text file relative to regexafter,before, or at the end of the file if neither are specified.Replace- Replace a line in the text file matching regexsearchwithreplace(regex capture groups permitted)Delete- Delete a line in the text file matching regexsearch- All edit operations support
failoverof another Edit Operation andrconfor rcon commands (string or list of strings)
- Run
clear_uploads.shto clear the files in the upload folder while preserving the empty folders for future use.