Automatically move files to webspace?

Use this forum if you have a relatively general question or comment about a game, Ventrilo, TeamSpeak, or Murmur/Mumble server with us. If you have a server-specific question that might not help out the community, please directly contact us through your control panel instead.
Post Reply
Hampster
New to forums
New to forums
Posts: 6
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Wed Jul 11, 2012 10:34 pm

Automatically move files to webspace?

Post by Hampster »

Hi there,

I'm looking to run a sort of cronjob that will automatically move logs ('adlpickupz' TFC logs, to be exact) from my server to my webspace. Is there an easy way to do this?

Ideally, I'd be able to discriminate whether someone was playing in the server (e.g. don't copy over empty logs).

Thanks
User avatar
Edge100x
Founder
Founder
Posts: 13120
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Automatically move files to webspace?

Post by Edge100x »

I don't know of a premade easy solution. You could just use "wget" to pull all of the files pretty easily, but anything beyond that would require some custom scripting.

(It's also important to note that you should not make your logs public, as they'll have your rcon password in them, so make sure they are in a folder that is not visible through the web.)
Hampster
New to forums
New to forums
Posts: 6
Joined: Wed Jul 11, 2012 10:34 pm

Re: Automatically move files to webspace?

Post by Hampster »

I ended up doing the following as a cronjob (I hope this is useful to anyone else!)

Code: Select all

#!/bin/sh
# get all logs and delete those under 65kB
wget ftp://user:pass@user.game.nfoservers.com/tfc/logs/*.log -N
find . -type f -size -65k -exec rm {} \;

# delete any lines that contain 'rcon'
grep -il rcon * | xargs -n 1 -I log sh -c 'grep -v rcon log > log'
Post Reply