Serverdoc

[About] [Getting Started] [Userguide]

Serverdoc Startup - read this and things will be easier :)

Installing & Running Serverdoc

Configuration
Schedule
Remote Access
Templates
Command Selection
Command Line Remote Edit
Remote File Editing
Misc Tricks
Updating

Serverdoc startup process, understand what goes on and setup is a lot easier.
Current directory (config folder) is the folder you run serverdoc from, i.e. the "start in" option in windows shortcuts or the directory you are in when you execute serverdoc.exe from ms-dos prompt.

When you execute serverdoc it:-
Checks the same directory serverdoc.exe is in for your serverdoc.key file (free/donation or pro mode)
Reads wwwconfig.cfg file in current directory and starts web server for remote control if required.
Loads schedule (schedule.txt - in current directory) if it exist.
Loads serverdoc config file, serverdoc.cfg from current directory.
Sets any command line configuration options (i.e. /L1 /P1  - see serverdoc.txt)
If no command line was entered, wwwrotate.dat (current directory) does not exist and schedule is empty then displays pop-up box with command line info.
If no command line was given, serverdoc checks for a command on the "run" line in wwwconfig then checks schedule.txt for the last command that should be running and executes that command. NOTE: a schedule event of 99 99 99 99 99 c:\folder\program.exe will be loaded on serverdoc startup
Starts the application specified in command line (or wwwconfig.cfg or schedule.txt) in low priority then will swtch to the configured setting
The server is now running, serverdoc will restart servers if they close and attempt to detect any crash windows and close them for you, then restart the server.
When serverdoc it used the run line from wwwconfig.cfg any changes to command line will be saved to the "run" line in wwwconfig.cfg

Installing & Running Serverdoc
I recommend you download and unzip the installation example file in the downloads section
Simply unzip serverdoc into the directory of your choice (we will use c:\serverdoc). The first time serverdoc runs it will create serverdoc.cfg in the current directory if serverdoc.cfg does not exist. To start serverdoc you can use sdcontrol.exe (found in installation examples) or create shortcuts. If you crate shortcuts you will need a shortcut for each instance of serverdoc you wish to run. If you are using sdcontrol.exe you will only need the one shortcut (sdcontrol.exe /START)to start all the serverdocs.
To create a shortcut to serverdoc, right click on desktop and browse to c:\serverdoc\serverdoc.exe and press ok/finish so you now have a shortcut on your desktop. Now right click no the short cut and select properties, here you can enter the command you want serverdoc to start (lets say its c:\program\myserver.exe):
TARGET: c:\serverdoc\serverdoc.exe c:\program\myserver.exe
and what directory to load the config files from:
START IN: c:\serverdoc
we will leave this as c:\serverdoc for now but if you want to run multiple serverdocs with different configs (and you will need to if you are using remote access) you need to change this "start in" directory to another directory for each copy serverdoc you plan to run (ie c:\serverdoc\scfg0032\ ) and save the config files (i.e. config.cfg, wwwconfig.cfg, etc.) in that directory or install a full serverdoc to a new directory ( maybe c:\serverdoc02\ ). I recommend you use sub directories to hold the config files for multiple servers that way you have the one serverdoc.exe/serverdoc.key to update. Having multiple installations of serverdoc will take longer to upgrade as you will have to update each serverdoc.exe when the time comes.

Now double click on your new shortcut and your serverdoc should load up and start your program. To start this automatically when your computer boots copy the short cut to the start - programs - startup folder.

Basic Serverdoc Configuration

Start Serverdoc minimized - will start serverdoc minimized (yes this stuff is complex heheh)
Start Server minimized - may not work with all programs as some programs Maximize themself.
Write Logfile - will write restarts etc to serverdoc.log
Server Priority - Setting this to real-time may lock your system.
Disable Extra Checking - Tick if Serverdoc keeps on incorrectly detecting a crashed server.
Disable Query Checking - Disable restarts when server does not respond to network queries. You must have port/ip values set in command line if not using default.
Allow public servers - if not ticked servers will be restarted if the password for the server is removed (if supported with that server)
Allow max x clients - If set to a value > 0 the server will be restarted if the max players on server is set higher then this value. Command line options for game server override this value.
Cpu Affinity - Select what CPU's the program serverdoc starts will use.
Force restart of program every x mins - Will restart program every x mins, simple :)
Restart Delay - Delay when restarting a crashed server.
Check Server every - How often server is checked to see if its alive.
SMTP Server - The mail server to be used for sending email.
Send mail to: - Email address to send crash reports to.

Schedule
Schedule.txt is to be saved in the same directory as serverdoc.cfg, this is the "start in" directory.
All commands in schedule.txt are to be in the below format
Min Hour Dayofweek Dayofmonth Month Command

Where:
 Min = 0 - 59, the Minute
 Hour = 0 - 23, 0 being midnight and 23 being 11pm
 Dayofweek = 1 - 7, 1 being Sunday, 2 Monday - 7 Saturday
 Dayofmonth = 1 - 31, depending on how many days are in current month
 Month = 1 - 12, 1 being Jan, 12 is Dec.
 Command = Command to run, ie C:\Games\quakeserver.exe +map fun
                  = STOP - stop current program and dont start another.
                  = START - Starts program that was last ran.
                  = restartoff - Do not restart servers if they crash
                  = restarton - Turn server restarting back on
                  = sdcmdstart - Issue start command to another serverdoc
                  = sdcmdstop - Issue stop command to anothert serverdoc

 * = any, always true.

Examples:
99 99 99 99 99 c:\windows\notepad
This is a special event, this event will be ran on serverdoc startup but no other time.

98 98 98 98 98 c:\windows\notepad
This is a "crash" event, will be ran when a application crashes or ends.

98 98 98 00 x This event is run when server starts
98 98 98 01 x even is run when server stops
This event is run when server stops or crashes. x is a number 0 - 99)
example: I have two serverdocs running and my config folders are c:\serverdoc\master\ and c:\serverdoc\slave\ If I wanted start the slave serverdoc when master one starts its server I would create the following file - c:\serverdoc\master\schedule.txt 98 98 98 00 00 sdcmdstart c:\serverdoc\slave\ 98 98 98 01 00 sdcmdstop c:\serverdoc\slave\ If I wanted the slave serverdoc to stop when the master starts and start when the master stops I would use (in c:\serverdoc\master\schedule.txt) 98 98 98 00 00 sdcmdstop c:\serverdoc\slave\ 98 98 98 01 00 sdcmdstart c:\serverdoc\slave\
This will start c:\windows\notepad at 50mins past every hour and stop at 55mins past.
50 * * * * c:\windows\notepad
55 * * * * stop

 -s will save current command that's running, run the new command then
 revert to the saved command once the new command finishes/crashes.
12 * * * * -s:update.exe

This will run a Half Life server on Monday & Tuesday, TFC on Wed, Thurs and Friday and Counterstrike on the weekend and run update.exe at 1am every day then load up the server that was running once update.exe stops.
00 00 2 * * * c:\halfli~1\hlds -console

00 00 4 * * * c:\halfli~1\hlds -console -game tfc

00 00 7 * * * c:\halfli~1\hlds -console -game cstrike
00 01 * * * * -s:update.exe


This will rotate every monday between Half-Life, TFC and Counterstrike.
rotate.dat contains:
c:\halfli~1\hlds -console
c:\halfli~1\hlds -console -game tfc
c:\halfli~1\hlds -console -game cstrike
and schedule.txt contains
00 00 2 * * * -r:rotate.dat
to rotate every day at 6am you would use
00 06 * * * * -r:rotate.dat

Remote Access
Remote access is set up via the wwwconfig.cfg file, saved in the "start in" folder.
You can also access this file via the serverdoc menu by clicking on menu - config - remote access.
this will contain the port and user/password/access levels. If you are running Serverdoc Pro you can also select the IP address to bind to
example wwwconfig.cfg
---cut---
port 82
ip 203.33.238.2
user myfriend mypass
user admin neverguess 2041 0
---cut---
Serverdoc will listen on port 82 on ip address 203.33.238.2 (only Pro verision supports IP selection) and create two accounts. One with only
stop/start functions (myfriend) and one with full config access. Leave the
second value 0 for now.

Other optional settings are:
user AllFromThisHost www.mygames.com
user AllFromThisHost 203.33.22.34
Allows clients from www.mygames.com to connect without user/password prompt. Like auth disable but only for a single ip.
NOTE: AllFromThisHost IS CASE SENSITIVE.
auth MyHosting co
auth displays the string when entering user/pass for remote control. (pro version)
systray Client #0330
systray will show the string on the taskbar icon, "Client #0330" in this case.
auth disable
will no longer prompt for password
fileedit keyword c:\folder\filename
Allow remote access to this file, see the remote file editing section.
BF2SERVERSETTINGSFILE c:\myfolder\filename.con
Location and filename of BF2 server settings file to use (used if your not using BF2 dedicated server)
Normally you will use 0 0 or nothing for access level but if you do want to offer config changes you need to add up the values of each item you want access to, type this
number in after the username and password.
1 Start Serverdoc minimized
2 Start Server minimized
4 Write Log file
8 Disable Extra Checking (server is running but serverdoc keeps restarting it)
16 Server Prority (I wouldn't let anyone have this!)
32 Force restart of program every XX mins (0 to disable)
64 Restart Delay XX Seconds (0 to disable)
128 Check server is running every XX Seconds
256 SMTP Server: XXXX (Leave blank = disable)
512 Send email to: XXXX
1024 Save Setting (serverdoc.cfg)

so, for an example, we want joe to be able to change log file and save
settings, 4+1024=1028. So we would use....

joe letmein 1028 0

easy :) Normally access level of 0 0 or nothing will be used.

Templates
You can make the serverdoc remote interface page look how you want my modifying the template.html file, this is saved in the configuration folder or main folder (with serverdoc.exe). Just add images, edit colours/text and change the layout like you would a normal html file.
The special keywords you can use are:
Keywords (replaced with values)
*SDFULLCOMMAND* - Current path & command line
*SDCOMMAND*  - Current command line
*FRIENDLYSDCOMMAND* - Friendly command running from wwwrotate.dat
*SDDATE* - Date
*SDTIME* - Time
*SDIP* - IP address serverdoc is using from wwwconfig.cfg IP line *SDVERSION* - Serverdoc version
*SDCFGSDMIN* - Start Serverdoc Minimized checkbox checked?
*SDCFGSVRMIN* - Start Server Minimized checkbox checked?
*SDCFGLOGFILE* - Write Logfile checkbox checked?
*SDCFGPLOW* - Prority Low checkbox checked?
*SDCFGPNORMAL* - Prority Normal checkbox checked?
*SDCFGPHIGH* - Prority High checkbox checked?
*SDCFGPREALTIME* - Priority Realtime checkbox checked?
*SDCFGDISABLEEC* - Disable Exta Checking checkbox checked?
*SDCFGFORCERESTART* - Force Restart value (mins)
*SDCFGRESTARTDELAY* - Restart Delay value (seconds)
*SDCFGCHECKSERVER* - Check Server Every x Seconds value
*SDCFGSMTPSERVER* - SMTP Server value
*SDCFGEMAILADDRESS* - Email Address value
*SDROTATEDROPBOX*  - Display selection of commands from wwwrotate.dat
*SDROTATEDROPBOXSHORT* - as above but do not display path names
*SDROTATEDROPBOXFRIENDLY* - displays <friendly name>, see wwwrotate_example.txt
*SDUSERNAME* - Username of remote user
*SDUSERPASS* - Password of remote user (useful if creating a ftp hyperlink with same user/pass)
*SDCONFIGNAME* - Folder name of serverdoc config

Conditions
Adding -R- after <SD (ie <SD-R-SECFL) = must NOT
<SDSECFLx>boo</SD> - Must have first access level x to include boo in html
<SDSECSLx>insert your code here</SD> - Must have second access level x
<SDSERVERRUNNING>insert your code here</SD> - Server must be running
<SD-R-SERVERRUNNING>insert your code here</SD> - Server must NOT be running
<SDUPDATERUNNING>insert your code here</SD> - hldsupdatetool.exe is running
<SD-R-UPDATERUNNING>insert your code here</SD> - hldsupdatetool.exe is NOT running
<SD_APP_SERVER.EXE>insert your code here</SD> - server.exe is program in commandine (replace "server.exe" as required)
<SDUSERNAME=Admin>insert your code here</SD> - only user Admin
<SDUSERIP=www.myhost.com>insert your code here</SD> - only connections from this ip/host
<SDACCEPTINGCONNECTIONS>insert your code here</SD> - query checks
For example if you wanted a big red light graphic to be displayed when the server is not running and a green one when it is running you would have something like:
<SDSERVERRUNNING><img src="http://mywebserver/greenlight.gif"></SD><SD-R-SERVERRUNNING><img src="http://mywebserver/redlight.gif"></SD>

To display the "start" link only when server is not running and display "stop" link when server is running:
<SDSERVERRUNNING><font size=+2>Start <a href="/stop">Stop</a></SD>
<SD-R-SERVERRUNNING><font size=+2><a href="/start">Start</a> Stop</SD>

Command Selection
The wwwrotate.dat file contains a list of commands to be made available via the remote interface. A simple wwwrotate.dat file offering two selections would look something like this
c:\hlserver\hlds.exe -console -game cstrike +map cs_mapname
c:\hlserver\hlds.exe -console -game dod +map dod_mapname

If you have serverdoc pro you can also have friendly names, this means instead of the command line being displayed to the remote client the friendly name you display will be shown. wwwrotate.dat would look something like this:
<Counter Strike>c:\hlserver\hlds.exe -console -game cstrike +map cs_mapname
<Day of Defeat><c:\hlserver\hlds.exe -console -game dod +map dod_mapname

"Counter Strike" and "Day of Defeat" will be displayed as options in the drop down command selection box. To show the drop down command selection box use the keyword *SDROTATEDROPBOXFRIENDLY* in your template file.

Example remote interface screen using friendly names


Remote Command Line Edit
To allow remote editing of a command line you need two things - Special keywords in command line and keywords in the template.html file. Serverdoc needs to know what parts of the command line are to be edited so we need to add *SDkeyword* to the command line where the edited value(s) will be placed.
For example, if we where running C:\server\hlds.exe -console -game dod and we wanted to be able to change dod to other values we would use C:\server\hlds.exe -console -game *SDgametype=dod*. The =dod assigns the default value of DOD to *SDgametype*, serverdoc will run the command C:\server\hlds.exe -console -game dod. If you did not want to assign a default value we would just use *SDgametype*.

Now to allow changing the value remotely we need a form in template.html, something like.
<FORM ACTION="/CHANGE" METHOD="GET">
Game <INPUT TYPE=text SIZE="10" NAME="*SDgametype*" value="*SDVgametype*">
<input type="submit" value="Change Command line"></form>

When "change command line" button is pressed, the browser will submit the value to *SDgametype*, Serverdoc will update the command line with this new value. You may notice the value="*SDVgametype*". The *SDVkeyword* is replaced with the current value of that keyword, its important you always set default form values to the current command line values.

The following example will show a drop down selection box instead of a text edit box, offering two options without having to manually type the value in.
<FORM ACTION="/CHANGE" METHOD="GET">
Game <SELECT NAME = "*SDgametype*">
<OPTION VALUE = "*SDVgametype*">*SDVgametype*
<OPTION VALUE = "Cstrike">HL - Counter Strike
<OPTION VALUE = "DOD">HL - Day of defeat</SELECT>
<input type="submit" value="Change Command line"></form>

NOTE: you can NOT have spaces in submitted values. This is for security reasons. If you wish to allow spaces use *SDCOMMANDLINE* - this will allow spaces

Some example command lines are:
c:\server\ucc.exe server *SDcl=DM-Curse4?game=XGame.xCTFGame?mutator=XGame.MutQuadJump* ini=UT2004.ini Multihome=67.19.224.190 log=server.log
(you can remotely edit DM-Curse4?game=XGame.xCTFGame?mutator=XGame.MutQuadJump)
c:\server\hlds.exe -console +game *SD2=cstrike* +map *SD1="de_dust"*
(you can remotely edit cstrike and de_dust values)

Tricks

Saving Command line
Restore Edited Cmd Line
Retart on same map
Saving command line
You can save the current command line so next time you start serverdoc (after reboot) it will load the saved command. Load serverdoc with the /SC LOAD option (ie Serverdoc.exe /SC LOAD) and add the line RUN command line to the wwwconfig.cfg file (replace "command line" with the program + options you wish to run) ie your wwwconfig.cfg may look like:
port 4547
user me mypassword 0 0
RUN c:\server\hlds.exe +game *SD2=Cstrike* -map *SD1=de_dust*

"Restore" edited command line.
You easy make a button to "restore" the command line to its original settings. If our default command line was C:\server\hlds.exe -console -game *SDgametype=dod* but DOD had been changed to something else, maybe a invalid value was entered. you can have a Restore (or "rescue me") button to restore default value(s).
<FORM ACTION="/CHANGE" METHOD="GET">
<INPUT TYPE=hidden NAME="*SDgametype*" value="DOD">
<input type="submit" value="Restore Command line"></form>

Restart on same map
By using the *sdautomap* keyword - restart game server on the map that was being played.
Serverdoc can now restart the server on the map that was being played. Example - if your command line is
c:\server\hlds.exe -console +map datacore
change it to:
c:\server\hlds.exe -console +map *sdautomap=datacore*
The sdautomap value will be updated with current map being played. Ensure query checks are enabled in serverdoc config.




Remote File Editing
You can allow access to whole files or just variables in files. First you need to configure the files you wish to edit. This is done in wwwconfg.cfg by entering
editfile keyword filename
you can also edit a single variable , say hostname in server.cfg
editfile keyword c:\server.cfg ? hostname

For Example, If I wished to allow access to mapcycle.txt file and only the hostname variable in server.cfg I would enter something like:
editfile myfile .\valve\mapcycle.txt
editfile myhostname .\valve\server.cfg ? hostname


Now in your template to change the hostname we need to add
<FORM ACTION="/CHANGE" METHOD="POST">
<BR>Hostname<INPUT TYPE=text SIZE="25" NAME="*SDFE-myhostname*" value="*SDFEV-myhostname*">
<input type="Submit" value ="Save" ></form>


see the *SDFEV- and *SDFE- ? The SDFEV stands for "Serverdoc File Edit Value", this is the contents of the file or variable. SDFE is the file you are saving to. In this HTML we are displaying the hostname (*SDFEV-myhostname*) value in server.cfg and submitting a text value to *SDFE-myhostname* (saved to hostname variable in server.cfg). myhostname was set in wwwconfig.cfg to \valve\server.cfg ? hostname

This HTML will display and save the contents of myfile (mapcycle.txt)
<FORM ACTION="/CHANGE" METHOD="POST">
<textarea name="*SDFE-myfile*" rows="10" cols="20" tabindex="1">*SDFEV-myfile*</textarea><BR>
<input type="Submit" value ="Save Map List" ></form>

This time its the whole file being edited, this is set in wwwconfig.cfg via editfile



Updating Serverdoc
Updating serverdoc is normally as simple as replacing the serverdoc.exe and/or serverdoc.key file with the new version. I email people on my mailing list as new versions come out. Also subscribe to the "latest serverdoc.exe" thread in message forums for info on the very latest serverdoc.exe (sub releases - this info is not sent via mailing list). If you are running a number of servers it is recommended you use the single serverdoc.exe and have sub directories under the serverdoc directory to hold the configuration files. You only have to update the one file (serverdoc.exe / serverdoc.key), this will make life easier :). Also future features will be built on this system.

V0.85B and later - Save serverdoc.exe as serverdoc.bin and select update in a serverdoc window. This will update serverdoc without closing your servers. Serverdoc should exit, update and resume monitoring of the server.

PRE V0.85b - If you have one copy of serverdoc running from each serverdoc.exe (ie if you have two serverdocs running you have 2 copies of serverdoc.exe on HDD) its possible to update without closing your server. Save the new serverdoc.exe as "server.bin" in the serverdoc directory and select update from the serverdoc menu.

PRE V0.85b -If you have the single serverdoc.exe running many copies of serverdoc you will have to close all the serverdoc's to update the .exe, while you have to close serverdoc you only have to replace the single serverdoc.exe (and single serverdoc.key file) if you have many servers each with there own serverdoc.exe it will take more time to update.