Official Soldat Forums
Server Talk => Server Help => Topic started 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.
-
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
-
thanks for the quick answer jrgp
can i create a script.sh with the code and use it with cronjob?
greets Shooter
-
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
-
thanks that is what i need <3
made my day
-
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 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!