Purging log files

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
mookie
Newcomer
Posts: 4
Joined: Sat Mar 11, 2023 8:25 pm
United States of America

Purging log files

Post by mookie »

I know I'm going to need to eventually provide log files for my mythtv issues. I've read the forum pages about this and i'm still struggling to understand.

As "practice" i attempted to purge the backend log file. > backend.log
I get "permission denied". Also tried "sudo >backend.log" Also denied. How do I fix that?
I read something about adding my user to the mythtv group, so I sudo usermod -g mythtv myuser
This did not fix my permission issue. Should I now remove that permission I just added?

thanks for any hand-holding
white_haired_uncle
Senior
Posts: 244
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: Purging log files

Post by white_haired_uncle »

The correct solution for what you're trying to do is going to depend on a couple things, like whether you're using syslog for myth logging. You should run "ps aux | grep backend" and post the output here.

So the following are just general unix comments based on your questions, which probably don't really belong here and are not intended to solve the issue you raised, but here you go:

sudo >backend.log - Not gonna work if you can't write to backend.log anyway. Generally, > doesn't work with sudo due to scope (I can't explain it well, but for example "sudo echo hi > hi.txt" means run "echo hi" as root, then send the output of the sudo command to hi.txt as yourself). I do something like sudo sh -e "echo hi > hi.txt" which runs a shell as root and executes the rest (all as root).

usermod adds a user to a group, but it doesn't make that change to active sessions. You need to login again, or run "newgrp mythtv" (but don't use newgrp unless you know why I say not to use it) for the change to take effect. You can see this using the id command.

usermod -g mythtv is almost certainly the wrong way to go (for any user that's not "mythtv"), and yes, you should change it back (probably usermod -g myuser myuser, but don't quote me on that because it may vary between unix/linux flavors). usermod -g changes the PRIMARY group for the user. usermod -aG adds the user as a member of the group, while retaining the user's primary group, which is what you wanted.
mookie
Newcomer
Posts: 4
Joined: Sat Mar 11, 2023 8:25 pm
United States of America

Re: Purging log files

Post by mookie »

Thank you very much for taking the time to respond.
User avatar
bill6502
Developer
Posts: 2299
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Purging log files

Post by bill6502 »

You may want to look into logrotate: https://www.mythtv.org/wiki/Logrotate_-_mythfrontend
Post Reply