Home
ubuntu startup script
- Details
If you need to run a script when you server boots then you can do the following. I run a few scripts at startup mostly to start the game server and logging.
Write a script. put it in the /etc/init.d/ directory.
if you named the file starttf.sh
% update-rc.d starttf.sh defaults
You also have to make the file you created executable:chmod +x starttf.sh
sample:
First make sure you file works without being in startup. don't use relative paths for the most part.
cp /runmystuff.sh/etc/init.d/
chmod +x /etc/init.d/ starttf.sh
update-rc.d starttf.sh defaults
update-rc.d: warning: /etc/init.d/ starttf.sh missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
Adding system startup for /etc/init.d/starttf.sh ...
/etc/rc0.d/K20starttf.sh -> ../init.d/starttf.sh
/etc/rc1.d/K20starttf.sh -> ../init.d/starttf.sh
/etc/rc6.d/K20starttf.sh -> ../init.d/starttf.sh
/etc/rc2.d/S20starttf.sh -> ../init.d/starttf.sh
/etc/rc3.d/S20starttf.sh -> ../init.d/starttf.sh
/etc/rc4.d/S20starttf.sh -> ../init.d/starttf.sh
/etc/rc5.d/S20starttf.sh -> ../init.d/starttf.sh
Even thou you see a warning, I reboot the server and the script runs.
This is the content of my starttf.sh
screen -dmS 'tf2' /steam/orangebox/srcds_run -game tf -autoupdate +map mvm_coaltown +maxplayers 32 -ip 192.168.1.22
Setting up Source Dedicated Server on Ubuntu 12
- Details
Setup Ubuntu 12.x with minimal extras.
I like to have root access so once the setup is done I do this
me@TF2-Server1:/# sudo passwd
This will set the root password. then type exit and relogin as root
You will need to install
root@TF2-Server1:/# apt-get install lib32gcc1
root@TF2-Server1:/# apt-get install zip
mkdir steam
cd steam
wget http://www.steampowered.com/download/hldsupdatetool.bin
chmod +x hldsupdatetool.bin
./hldsupdatetool.bin
./steam
Install Counter Strike Source:
./steam -command update -game "Counter-Strike Source" -dir /steam
Install Team Fortress 2
./steam -command update -game tf -dir /steam
Now we need to add a file and enter the text 440:
TF2
nano /steam/orangebox/steam_appid.txt
440
CSS
nano /steam/css/steam_appid.txt
240
^@
(save the file: [ctrl]x )
if you don't do this you will get the issue:
* Unable to load Steam support library. *
* This server will operate in LAN mode only. *
so your server is basically offline.
Start the server TF2:
screen -dmS 'tf2' /steam/orangebox/srcds_run -game tf -autoupdate +map mvm_coaltown +maxplayers 32 -ip 192.168.1.22
Start the server CSS:
screen -dmS 'css' /steam/css/srcds_run -game cstrike -autoupdate +map de_dust2 +maxplayers 20 -ip 192.168.1.25
Auto start on server bootup:
Please read this article Ubuntu Startup
activity timeout
- Details
activity timeout occurs when the timeout of the IIS process times out before the child/orphan process times out.
In the case of PHP the php-cgi.exe is still running but the IIS process times out first.
Error: The FastCGI process exceeded configured activity timeout
if you adjusted the php.ini settings and you still get this error
Open IIS
Top Level server settings
Click FastCGI settings
Select the correct version of the cg exe
change the time out here
Fail2 ban on windows 2008
- Details
This will ban IPS that fail to login after so many times.
Make a firewall inbound Rule called BlockAttackers that is a blacklist (block all ports. scope Remote IP address: these IP address)
Make a powershell script
$DT = [DateTime]::Now.AddDays(-1)
$l = Get-EventLog -LogName 'Security' -InstanceId 4625 -After $DT | Select-Object @{n='IpAddress';e={$_.ReplacementStrings[-2]} }
$g = $l | group-object -property IpAddress | where {$_.Count -gt 20} | Select -property Name
$fw = New-Object -ComObject hnetcfg.fwpolicy2 # get firewall object
$ar = $fw.rules | where {$_.name -eq 'BlockAttackers'}
$w = $g | where {$_.Name.Length -gt 1 -and !$ar.Name.contains($_)}
or download this one ps-get-ipaddr-failaudit.ps1
Create task in scheduler and set trigger to event 4625 (windows login including terminal services). But you can set trigger to run e.g. twice per hour to avoid unnecessary loading the server.
and after trigger run powershell script. You must also set higher privileges to run this script, otherwise it will fail with security exception.
You can also bind this script to other security events.
Page 19 of 40