Help with djson..
#1

I have djson in a Linux server, it creates the 'cache' file, it looks like this:

Code:
djson-db-cache.619
But the problem is that when you shutdown the server or simply restart it, the file doesn't get deleted, it's strange because in Windows this doesn't happend.

Thanks.
Reply
#2

If the server is closed properly (that is, with the 'exit' rcon command), the file gets deleted.
If this is a major issue in your server, you could write some code in OnGameModeInit that checks if any file starting with djson-db-cache exists and delete it.
Reply
#3

Quote:
Originally Posted by Zamaroht
View Post
If the server is closed properly (that is, with the 'exit' rcon command), the file gets deleted.
If this is a major issue in your server, you could write some code in OnGameModeInit that checks if any file starting with djson-db-cache exists and delete it.
I close it with the panel, OnGameModeExit get's called, so it's like doing 'exit'.

How would be the code to check if a file starts with djson.. ?

Thanks
Reply
#4

It's weird, I usually have that problem with the cache files when the server gets closed incorrectly.
Anyway, this code might be a bit slow, but it isn't an issue since it's just called once when the server starts up:

pawn Code:
stock DeleteDJSonCacheFiles()
{
    new filename[24];
    for(new i; i < 1000; i ++)
    {
        format(filename, sizeof(filename), "djson-db-cache.%d", i);
        if(fexist(filename))
            fremove(filename);
    }

    return 1;
}
Make a call to the DeleteDJSonCacheFiles(); function inside OnGameModeInit, before djson_GameModeInit().
Reply
#5

I get this problem on linux too, it deletes fine with windoze though everytime. I'll be using that function too thanks Zamaroht.
Reply
#6

Quote:
Originally Posted by Zamaroht
View Post
It's weird, I usually have that problem with the cache files when the server gets closed incorrectly.
Anyway, this code might be a bit slow, but it isn't an issue since it's just called once when the server starts up:

pawn Code:
stock DeleteDJSonCacheFiles()
{
    new filename[24];
    for(new i; i < 1000; i ++)
    {
        format(filename, sizeof(filename), "djson-db-cache.%d", i);
        if(fexist(filename))
            fremove(filename);
    }

    return 1;
}
Make a call to the DeleteDJSonCacheFiles(); function inside OnGameModeInit, before djson_GameModeInit().
Thanks, I just added a break;, because there will be only one file :P

Thanks Zarmoth

EDIT:

Just a little tweak you have to do, you must change:

Code:
format(filename, sizeof(filename), "djson-db-cache.%d", i);
To:

Code:
format(filename, sizeof(filename), "djson-db-cache.%d.db", i);
You forgot the .db part.
Reply
#7

Mhh.. still not working on Linux :/

pawn Code:
new time = GetTickCount();
new file[24], files;
for(new i; i < 1000; i ++)
{
    format(file, 24, "djson-db-cache.%d.db", i);
    if(fexist(file))
    {
        files++;
        fremove(file);
    }
}
printf("Cache files deleted in: %d ms. Total cache files deleted: %d", GetTickCount()-time, files);
It counts the files, and the ms increases(meaning that it's prossesing it), but they don't get deleted.. why?
Reply
#8

http://dev.dracoblue.net/index.php/DJson#djRemoveFile
Reply
#9

That code it's before djson_GameModeExit(), it should be deleted.
Reply
#10

Bump!!..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)