Auto-reloading files on a Linux dedicated server?

When I was with NFO, they used Windows for hosting the servers. I decided to move to my own server running Linux (not going to say why as it’s unrelated), but I almost immediately noticed one thing: when I uploaded a file to it via FTP, the server didn’t automatically reload the file like it did with the old server on Windows. If it helps, the server in question is DarkRP but I’d prefer a method that works on all gamemodes.

Linux doesn’t have Lua autorefresh.

I have an NFO Linux server and autorefresh works. Although it may be something custom.

Thats why I’m posting here, I’m looking for something that could somehow emulate that feature.

hm, think you could find out how they do it?

Download this: https://dl.dropboxusercontent.com/u/26074909/tutoring/_redistributable/basedev_gamemode.rar

Something similar to it… The cl init, and init files should be exactly as they are.

sh_init.lua should be a little bit different… First, the zip only gives a very basic recursive function to load files and doesn’t allow transferring of realms through different filenames, foldernames etc… I’ll be releasing another sh_init.lua soon which does that.

Essentially to “fake” auto-refresh, you’d put the includes into a function, and call that function right away.

Here’s an example of what you can do:


loader = loader || {};

function loader:Init( )
	// AddCSLuaFiles for client to download...
	if ( SERVER ) then
		AddCSLuaFile( "client_file.lua );
		AddCSLuaFile( "shared_file.lua" );
	end

	//
	// Includes block
	//

	// Shared first
	include( "shared_file" ); -- Although, shared should be loaded first...

	// Server / Client next, doesn't matter
	if ( SERVER ) then
		include( "server_file.lua" );
	else
		include( "client_file.lua" );
	end

	// Addons

	// Content
end

// Load the game-mode:
loader:Init( );

//
// Fake Auto-Refresh to get by the annoyance of saving multiple files for new files to show up; or for linux...
//
concommand.Add( "loadgm", function( ply, cmd, args )
	if ( ply != NULL && !ply:IsSuperAdmin( ) ) then return; end
	GM = GAMEMODE; -- To allow GM to function as GAMEMODE as GM is only active during init
	loader:init( ); -- Load it....
	BroadcastLua( "GM = GAMEMODE; loader:init( );" ); -- If called on server, tell all clients to reload
end );

just got the email on this thread, what do you mean by ‘transferring of realms between different filenames, foldernames etc’? Do you mean, if I define a function in one file/folder, it won’t be available in another or what?

Basically the skeleton game-mode I linked doesn’t have the most up-to date auto-loader. I’ll be releasing that on bit soon. The new loader has these features:

https://dl.dropboxusercontent.com/u/26074909/tutoring/_redistributable/basedev_gamemode/documentation/file_recursive_inclusions.txt

https://dl.dropboxusercontent.com/u/26074909/tutoring/_redistributable/basedev_gamemode/documentation/folder_structure_and_how_to_use_it.txt

The current one only loads specific directories and the maps directory. If you have a file named cl_blah in the server folder, it’ll be loaded on the server…

If you already have something in place; all you’d essentially need is the loadgm console command; put your includes into a function and set it up like that example. Any time you want to refresh the game-mode, type loadgm in console. ( If you want it to load server and client, wrap the command with if SERVER then … ) If you leave as is, if you type loadgm in the server-console, server and client will update. If you use it in your client, then only client will update.

Ah, ok. Also, why not use github to host the files? :stuck_out_tongue:

I actually have it up on Bitbucket ( currently locked while I finish the uploads and minor changes ) : https://bitbucket.org/Acecool/acecool-dev-base

I’m still working up cleaning up some of the helper-functions, and some basic / useful hooks such as Player Fully Connected, PlayerStarted/StoppedRecording, PlayerChangedResolution, etc… to go with the skeleton.

Basically it’ll just be a skeleton with a ton of dev-functions, hooks, meta-table objects, etc…

Sweet, I’m probably gonna make a (private) gamemode using this + graybox, lol

Feel free to add me on Steam if you’re looking to start a little early.

Added, I’m carcinoGenecist on steam :stuck_out_tongue: