Raised This Month: $12 Target: $400
 3% 

[batch] sm plugins ftp (sftp) uploader


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 10-24-2018 , 04:27   [batch] sm plugins ftp (sftp) uploader
Reply With Quote #1

This CMD (batch) file allows you save a time if:
  • you are developing plugins
  • you need upload the same plugin on server again and again (after each local modification)

Purpose:
It automatically compile and upload smx file to FTP (using CURL or Putty) as soon as its timestamp is changed.
When you edit your .sp file press Ctrl + S and it will be compiled (in background) and uploaded in a second.
Alternatively, you can set to track only smx (compiled files).

Versions:
There are 2 version of uploader:
  • 1.2 (for ftp only, using curl.exe)
  • 1.3 (for both sftp and ftp, using pscp.exe (putty command line tool)).

Preparation:
1) (optional) Using Plugin-autoreload is highly recommended. See attached autoreload.zip (it is an optimized fork of original).
Compile it and place in server .../addons/sourcemod/plugins/ folder.

2) Download one of attached sm_upload_*.zip archive. Unpack.

3) Dependency:
- (for v.1.2 only) Download and place CURL.exe in the same folder.
- (for v.1.3 only) Install Putty
- Download local compiler: from here. Unzip it.

4) Edit "sm_upload.cmd" file (open in notepad: right mouse click => Edit).
Set correct path and settings here:
Code:
:: path to spcomp.exe of local compiler
set compiler=d:\dev\SourceMod\addons\sourcemod\scripting\spcomp.exe

:: server settings (in v.1.3)
set server=5.x.x.x
set port=22
set user=l4dserver
set pass=xxx
set servpath=/home/l4dserver/serverfiles/left4dead/

:: or this line (in v.1.2)
set ftp=ftp://user:[email protected]/left4dead/

:: Specify true if you want to upload source files (.sp) as well
set upload_source=false
Save.


How to use:
1) Edit "plugins.txt" file: add full paths to plugins (smx or sp) you want to track.
2) Run "sm_upload.cmd" file and minimize its window to tray every time you need uploader to work.

Alternatively:
You can add files for tracking by context menu (Right Button Mouse Click on any.sp or any.smx file => SendTo => "SM - Track for upload").
To install such menu:
  • create shortcut to "SM - Track for upload.cmd" file.
  • place that shortcut in SendTo folder. To find that folder: press Win + R and enter Shell:SendTo than press OK and paste shortcut there.

You are ready.
Good luck.

Compatibility: Windows Vista+.

Update
Now *.phrases.txt files are also supported.
Attached Files
File Type: zip sm_upload_ftp_1.2.zip (2.1 KB, 135 views)
File Type: zip autoreload.zip (1.5 KB, 146 views)
File Type: zip sm_upload_sftp_1.3.zip (1.9 KB, 158 views)
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 01-26-2020 at 11:32. Reason: added sftp ver.1.3
Dragokas is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 10-25-2018 , 01:05   Re: [batch] sm plugins ftp uploader
Reply With Quote #2

Updated to v1.1
- Added opportunity to set mask * like c:\path\*.sp (though, it's not recursive, subfolders are not included).
- Added opportunity to add files for tracking by context menu => SendTo (see above for instruction how to add).
- Improved error displaying
- curl: removed -v switch. Add it yourself if you want verbose info.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]

Last edited by Dragokas; 10-25-2018 at 01:22.
Dragokas is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 10-28-2018 , 06:02   Re: [batch] sm plugins ftp uploader
Reply With Quote #3

Updated to v1.2
- Fixed cases with infinite uploading when plugin name begins with number.
- Fixed infinite errors in console when file is no longer exists.
- Improved console log formatting.
- Added ability to track and upload translation files (*.phrases.txt).
- Added ability to upload source files (it's require you change "upload_source" variable to 'true'). Disabled by default.
- Added ability to track and upload any kind of files (files that not meet criteria *.sp, *.smx, *.phrases.txt will be uploaded to addons/sourcemod/data/ folder, defined by "data" variable).
- Added variable "scripting" - location of source files subfolder on ftp ('addons/sourcemod/scripting/' by default).
- Added variable "plugins" - location of plugins subfolder on ftp ('addons/sourcemod/plugins/' by default).
- Added variable "translations" - location of translations subfolder on ftp ('addons/sourcemod/translations/' by default).
- Added variable "data" - location of data subfolder on ftp ('addons/sourcemod/data/' by default).
- BE ATTENTIVE !!! Format of "ftp" variable is changed!!! Now it include only ftp authorization, ip and root folder name only (without full path to 'plugins').
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 01-26-2020 , 11:02   Re: [batch] sm plugins ftp uploader
Reply With Quote #4

Added FTP (SFTP) Uploader v.1.3:

Quote:
- Now supported SFTP protocol
New requirement:

Quote:
- Installed Putty.
Added plugin-autoreload fork:

Quote:
1.2 (22-Nov-2019)
- Converted to a new syntax and methodmaps
- Added ConVar "sm_autoreload_delay"
- Some code optimizations

1.1
- Added command "sm plugins load" in case plugin is not loaded last time due to startup error

// TODO:
- check smx integrity before trying to load it.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode