PtokaX forum

PtokaX => Support => Topic started by: Mandyblue on 28 June, 2012, 21:19:08

Title: unsaved settings
Post by: Mandyblue on 28 June, 2012, 21:19:08
I'm running a hub on centos linux and if i register a user with the hub commands then as soon as i reboot the hub the user is not registered anymore.
The same thing happens with bans.
I did check the CFG files but they are writeable.
So my question is why aren't those things saved?


Thanks Mandyblue
Title: Re: unsaved settings
Post by: bastya_elvtars on 29 June, 2012, 12:58:07
What do you mean by 'reboot the hub'?
Title: Re: unsaved settings
Post by: Mandyblue on 29 June, 2012, 19:58:55
what i mean with reboot is the same thing you do with your pc after let say a update...

reboot - restart
Title: Re: unsaved settings
Post by: the-master on 29 June, 2012, 20:30:59
stop hub serving, save settings and shut down?
Title: Re: unsaved settings
Post by: Mandyblue on 29 June, 2012, 22:34:01
It is running as a service so i kill the process and do the thing i needed to do and then start the hub as service again, after that the bans and registered users are not present anymore according to the hub.
Title: Re: unsaved settings
Post by: the-master on 30 June, 2012, 08:16:18
You kill ptokax while its running, how should it save the settings if you force it to stop?
Try !restart before killing it, that should give the hub time to save changes.
Title: Re: unsaved settings
Post by: Mandyblue on 01 July, 2012, 14:23:00
 I tried the !restart function and after i killed the proces i got the same result, the users and bans are gone. :(
Title: Re: unsaved settings
Post by: PPK on 01 July, 2012, 14:45:02
Use this script to save settings, bans, regs etc. anytime you want (you need to use command !save from client connected as profile 0 [master in default])
function ChatArrival(curUser, sData)
    if curUser.iProfile == 0 then
        if sData:sub(curUser.sNick:len()+4, sData:len()-1) == "!save" then
            SetMan.Save()
            RegMan.Save()
            BanMan.Save()
            ProfMan.Save()
            Core.SendToUser(curUser, "<"..Core.GetHubSecAlias().."> Saved.|")
            return true
        end
    end
end
Title: Re: unsaved settings
Post by: Mandyblue on 01 July, 2012, 15:41:28
 That script works like a charm, thanks for the help

if i need some more answers i be back
thanks again  :-*  :-*
Title: Re: unsaved settings
Post by: PPK on 01 July, 2012, 16:14:14
Good, now better script with autosave every x (by default 60) minutes  8)
nSaveInterval = 60 -- save interval in minutes

function OnStartup()
   TmrMan.AddTimer(nSaveInterval * (60 * 1000), "SaveSettings")
end

function SaveSettings(uTimerId)
   SetMan.Save()
   RegMan.Save()
   BanMan.Save()
   ProfMan.Save()
end
Title: Re: unsaved settings
Post by: Mandyblue on 01 July, 2012, 18:48:47
Thats great thanks again  :-*  :-*