View unanswered posts | View active topics * FAQ    * Search
* Login 




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
NiwatoriKami
 
PostPosted: Sat, Nov 21 2015, 0:53 AM 

User avatar

Player

Joined: 23 Oct 2015

This might be helpful for those who need to rotate the chatlogs and server messages on the Linux Client. I found a discussion on reddit and found a script that can do this.

There are some caveats however:

    1. If the server crashes, the script doesn't detect this and seems to keep on logging when re-entering the server without exiting the client

    2. The script needs to run before launching the client once for it to run in the background. You have to repeat this step after restarting your PC or have it run at boot.

    3. You must have the utility called entr installed. Normally, this can be installed via sudo apt-get install entr

How to create and install:

    Step 1. Create an empty text file such as NWNchatlogrotator.sh and copy-paste the code below.

    Chatlog Rotator Script
    Code:
    #!/usr/bin/env bash

    export NWN_DIRECTORY=(insert the location of the NWN directory here without the parentheses such as /home/username/NeverwinterNights)
    export LOG_DIRECTORY="$NWN_DIRECTORY/logs"
    export LOG_FILE="$LOG_DIRECTORY/nwclientLog1.txt"

    rotate_log() {
      entr bash -c '
      cp "$LOG_FILE" "$LOG_DIRECTORY/$(date +%d-%m-%G-%H-%M-%S.log)"
      echo "Log rotated!"
      '
    }

    find "$LOG_DIRECTORY" -name "nwclientLog1.txt" | rotate_log


    Step 2. Save the file to your NWN directory

    Step 3. You have to make the file created an executable by going into terminal and go to your NWN directory and type chmod u+x ~/(name you gave the chatlog rotator script such as NWNchatlogrotator.sh)

    Step 4. Run the script before loading your game client

Hope this helps fellow Linux client users.


 
      
Gravemaskin
 
PostPosted: Sat, Nov 21 2015, 9:26 AM 

User avatar

Player

Joined: 29 Jul 2007
Location: Norway: Home of the Trolls

Or just have a bat file..

@ECHO OFF
START /w nwmain.exe
FOR /F "TOKENS=1-3 DELIMS=/ " %%a IN ("%date%") DO SET dd=%%a&SET mm=%%b&SET yy=%%c
FOR /F "TOKENS=1-3 DELIMS=:." %%a IN ("%time%") DO SET hh=%%a&SET tt=%%b&SET ss=%%c
COPY "logs\nwclientLog1.txt" "logs\NWNLOG%yy%-%mm%-%dd%_%hh%h%tt%m%ss%s.txt"

_________________
Adair - Druid and part time treant cosplayer


 
      
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 


Who is online

Users browsing this forum: No registered users and 91 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group