Author Topic: Soldat Server Log Cleaner  (Read 3450 times)

0 Members and 1 Guest are viewing this topic.

Offline PKS|Shooter

  • Soldier
  • **
  • Posts: 130
  • Dont fuck with us!
    • PKS - La Familia
Soldat Server Log Cleaner
« 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.

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5037
Re: Soldat Server Log Cleaner
« Reply #1 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
There are other worlds than these

Offline PKS|Shooter

  • Soldier
  • **
  • Posts: 130
  • Dont fuck with us!
    • PKS - La Familia
Re: Soldat Server Log Cleaner
« Reply #2 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

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5037
Re: Soldat Server Log Cleaner
« Reply #3 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
There are other worlds than these

Offline PKS|Shooter

  • Soldier
  • **
  • Posts: 130
  • Dont fuck with us!
    • PKS - La Familia
Re: Soldat Server Log Cleaner
« Reply #4 on: January 06, 2015, 05:35:57 am »
thanks that is what i need <3

made my day

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5037
Re: Soldat Server Log Cleaner
« Reply #5 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
There are other worlds than these

Offline PKS|Shooter

  • Soldier
  • **
  • Posts: 130
  • Dont fuck with us!
    • PKS - La Familia
Re: Soldat Server Log Cleaner
« Reply #6 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!