Knoxvilles_joker
Refugee
So since the game has a bit of a memory leak perofrmance issue, tracking your processor performance is a good thing.
So what command can we use to grab test and port to a text file?
top -b -n 1 -d 3 -o +%CPU | sed -e '1,/PID/d' | head -4 | ts '[%Y-%m-%d %H:%M:%S]' >> cpu_usage.log
top is the linux equivalent to task manager. You just have to use the kill command and the pid of the offending process. sed is a text processing command. Head is a command to display x number of lines that you specify of the output of a text stream. ts is a command used to add a timestamp to the line. >> appends output to a file.
I had to do a chown on cpu_usage.log to make the logged in user the owner.
Now take the ext stream with top and put it into a file. So say do: sudo vi 7dayscpu.sh, i to enter insert mode, paste in the command string, hit escape to exit insert mode. type :wq to save and exit the file.
Now set file to executable so do chmod +x 7dayscpu.sh
Now we have that we need to add a couple of lines to crontab
so we do: sudo crontab -e
We add:
0 * * * * /usr/local/bin/cpu7days.sh
@weekly /usr/local/bin/cleanlog.sh
The way the line is for cpu7days.sh is, it is set to run once per hour.
Then the cleanlog.sh is set to purge the file once every 7 days.
Contents of cleanlog.sh:
#!/bin/bash
cat /dev/null > /usr/local/bin/cpu_usage.log
Contents of 7dayscpu.sh:
#!/bin/bash
top -b -n 1 -d 3 -o +%CPU | sed -e '1,/PID/d' | head -4 | ts '[%Y-%m-%d %H:%M:%S]' >> cpu_usage.log
This will hopefully give you a snap shot of where you need to tweak your setup, add memory, or bounce the server.
So what command can we use to grab test and port to a text file?
top -b -n 1 -d 3 -o +%CPU | sed -e '1,/PID/d' | head -4 | ts '[%Y-%m-%d %H:%M:%S]' >> cpu_usage.log
top is the linux equivalent to task manager. You just have to use the kill command and the pid of the offending process. sed is a text processing command. Head is a command to display x number of lines that you specify of the output of a text stream. ts is a command used to add a timestamp to the line. >> appends output to a file.
I had to do a chown on cpu_usage.log to make the logged in user the owner.
Now take the ext stream with top and put it into a file. So say do: sudo vi 7dayscpu.sh, i to enter insert mode, paste in the command string, hit escape to exit insert mode. type :wq to save and exit the file.
Now set file to executable so do chmod +x 7dayscpu.sh
Now we have that we need to add a couple of lines to crontab
so we do: sudo crontab -e
We add:
0 * * * * /usr/local/bin/cpu7days.sh
@weekly /usr/local/bin/cleanlog.sh
The way the line is for cpu7days.sh is, it is set to run once per hour.
Then the cleanlog.sh is set to purge the file once every 7 days.
Contents of cleanlog.sh:
#!/bin/bash
cat /dev/null > /usr/local/bin/cpu_usage.log
Contents of 7dayscpu.sh:
#!/bin/bash
top -b -n 1 -d 3 -o +%CPU | sed -e '1,/PID/d' | head -4 | ts '[%Y-%m-%d %H:%M:%S]' >> cpu_usage.log
This will hopefully give you a snap shot of where you need to tweak your setup, add memory, or bounce the server.