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
Automatically move files to webspace?
-
- New to forums
- Posts: 6
- https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
- Joined: Wed Jul 11, 2012 10:34 pm
Re: Automatically move files to webspace?
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.)
(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.)
Re: Automatically move files to webspace?
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'