Donate to the B3 fund!

"even a small donation helps!"
Donate with PayPal!
The creator of these plugins has not shown activity in a while. Posting in this board may not result in a fast reply or a reply at all. [ Read the full Support Disclaimer here ]
Most of the plugins here are made by B3 users and the authors may not visit frequently. If you need support for plugins or if questions remain unanswered, you will have to contact the author directly. Read the full Support Disclaimer here

NOTE: Do not attach plugins to your forumtopics! Attachements are periodically removed by maintenance tasks. Upload your plugins to our Downloads section instead!

Author Topic: Console Commands  (Read 16624 times)

Offline Anubis

  • Moderator
  • Sr. Member
  • *
  • Posts: 228
    • g4g.pl
Console Commands
« on: January 04, 2009, 11:51:50 AM »
Hi
sometimes there is a must to launch some console commands at desired time to perform some maintenance (or smth) on the server when there are no players connected, mostly at night. However, probably we're sleeping at this time as well. Because of that we're updating our PB ban lists at night there is a must to launch two commands: pb_sv_banempty - to empty current ban list, and pb_sv_banload - to load a new list again. I've developed new plugin which is able to call defined list of commands at desired time. Config file looks like this:
Code: [Select]
<configuration plugin="consolecommand">
  <settings name="settings">
    <set name="hour">5</set>
    <set name="minute">0</set>    
  </settings>
  <commands>
    <command>pb_sv_banempty</command>
    <command>pb_sv_banload</command>
  </commands>
</configuration>
At commands section you can define as many commands as you like, not only those two. The result of executed commands are stored in the log file:

Code: [Select]
090104 05:00:02	DEBUG	ConsolecommandPlugin: Command started: pb_sv_banempty
090104 05:00:03 DEBUG ConsolecommandPlugin: Command response: ^3GV Protected Server: Ban List (in Memory) has been Emptied
090104 05:00:03 DEBUG ConsolecommandPlugin: Command started: pb_sv_banload
090104 05:00:04 DEBUG ConsolecommandPlugin: Command response: ^3GV Protected Server: xxxxx Bans loaded from .....cod4/pb/pbbans.dat

Download:
http://anoobis.republika.pl/b3/consolecommand/consolecommand.zip

I hope it will be usefull for you ;)

HF

regards

Anubis
« Last Edit: June 08, 2009, 06:49:31 PM by xlr8or »

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4883
    • Github repository
Re: Console Commands
« Reply #1 on: January 04, 2009, 05:33:52 PM »
N1  ;)

An idea for futur versions : allowing to define different <commands> groups in the config with different times.
Maybe something like :
Code: [Select]
<configuration plugin="consolecommand">

  <commands hour="5" minute="0">
    <command>pb_sv_banempty</command>
    <command>pb_sv_banload</command>
  </commands>

  <commands hour="6" minute="30">
    <command>bigtext go to bed kids !</command>
  </commands>

  <commands day="1" month="1" hour="0" minute="0">
    <command>bigtext Happy new year !</command>
  </commands>

</configuration>

Offline Anubis

  • Moderator
  • Sr. Member
  • *
  • Posts: 228
    • g4g.pl
Re: Console Commands
« Reply #2 on: January 05, 2009, 08:34:14 AM »
yeah... good point. Thanks for feedback.

Offline fistfight

  • Full Member
  • ***
  • Posts: 59
Re: Console Commands
« Reply #3 on: January 07, 2009, 11:44:47 PM »
I have each of my game servers installed under their own user accounts and I have a copy of B3 installed along side each of those servers.

So for instance I have a cod4 server installed at /home/cod4-1 and I have b3 installed at /home/cod4-1/b3  the user on the account is cod4-1 and the group is "servers". Could there be a way to make this plugin interact in the linux environment. Maybe shutdown the game server and rotate out the game logs at a given time and then restart the server?

Be a good way of cleaning up large log files before they reach 2gb and crash the server.

Offline Courgette

  • Senior Dev.
  • Hero Member
  • *
  • Posts: 4883
    • Github repository
Re: Console Commands
« Reply #4 on: January 07, 2009, 11:49:47 PM »
@fistfght: a plugin can indeed run shell commands, but as the user used to run b3.
Also, if you want to rotate your logs, look at http://linuxcommand.gds.tuwien.ac.at/man_pages/logrotate8.html

Offline fistfight

  • Full Member
  • ***
  • Posts: 59
Re: Console Commands
« Reply #5 on: January 08, 2009, 01:31:13 AM »
@fistfght: a plugin can indeed run shell commands, but as the user used to run b3.
Also, if you want to rotate your logs, look at http://linuxcommand.gds.tuwien.ac.at/man_pages/logrotate8.html
@Courgette: I looked into that once and had issues with it because if the game server was running still then the log file was open for writing. If the log was rotated out a new file was never created until the game server was restarted.

I use scinterface to run my servers and I use a script on it now that allows me to stop, delete and restart the server (thus creating a new log) but I have to run the script from the interface manually.

Be nice to automate the process. Guess I need to keep experimenting.


Offline grosbedo

  • Former Dev. (senate)
  • Sr. Member
  • *****
  • Posts: 258
Re: Console Commands
« Reply #6 on: August 28, 2010, 12:29:22 PM »
I use scinterface to run my servers and I use a script on it now that allows me to stop, delete and restart the server (thus creating a new log) but I have to run the script from the interface manually.

Be nice to automate the process. Guess I need to keep experimenting.

2 options :

- After logrotate rotated the logs, touch a new empty file :

Code: [Select]
       # sample logrotate configuration file
       compress

       /home/user/yourgame/some.log {
           rotate 5
           daily
           postrotate
                                     touch /home/user/yourgame/some.log
           endscript
       }

- Use a script Ive made to work on any q3a based game, called OpenArena Multi-Purpose Server Launcher. It has the capability to rotate logs based on size limit, before launching the game server. It has many other features as well.

More infos :

http://www.superbots.org/modules.php?name=Downloads&op=getit&lid=28

 


Rate this page +1 at Google Search