Official Soldat Forums

Server Talk => Server Help => Topic started by: PKS|Shooter on January 06, 2015, 05:21:51 am

Title: Soldat Server Log Cleaner
Post by: PKS|Shooter on January 06, 2015, 05:21:51 am
Hello,

is there any script that cleans the logs for soldat servers?

Happy new year :)

greets Shooter.
Title: Re: Soldat Server Log Cleaner
Post by: jrgp on January 06, 2015, 05:30:14 am
Run this in your soldatserver folder. It removes logfiles older than 14 days:

find logs -type f -iname '*.txt' -mtime +14 -print -delete

To list them first:

find logs -type f -iname '*.txt' -mtime +14 -ls
Title: Re: Soldat Server Log Cleaner
Post by: PKS|Shooter on January 06, 2015, 05:32:40 am
thanks for the quick answer jrgp

can i create a script.sh with the code and use it with cronjob?

greets Shooter
Title: Re: Soldat Server Log Cleaner
Post by: jrgp on January 06, 2015, 05:33:22 am
Yeah. Make this the contents of your script:

#!/bin/bash
cd FullSoldatServerPathHere
find logs -type f -iname '*.txt' -mtime +14 -print -delete

then chmod +x it and put its path in your crontab -e
Title: Re: Soldat Server Log Cleaner
Post by: PKS|Shooter on January 06, 2015, 05:35:57 am
thanks that is what i need <3

made my day
Title: Re: Soldat Server Log Cleaner
Post by: jrgp on January 06, 2015, 05:52:05 am
thanks that is what i need <3

Sure. Just make sure your crontab syntax is correct: http://en.wikipedia.org/wiki/Cron#Overview

For easyness, you can use this to make your script run every day:

@daily PathToYourScript
Title: Re: Soldat Server Log Cleaner
Post by: PKS|Shooter on January 06, 2015, 06:02:24 am
thanks that is what i need <3

Sure. Just make sure your crontab syntax is correct: http://en.wikipedia.org/wiki/Cron#Overview

For easyness, you can use this to make your script run every day:

@daily PathToYourScript

Thanks for the info!