Skip to content
Snippets Groups Projects
Commit 25766679 authored by drebrez's avatar drebrez Committed by Oliver Smith
Browse files

Add `-c, --clear` argument for `log` and `log_distccd` actions to clear log files (#344)

parent 6a129669
No related branches found
No related tags found
No related merge requests found
......@@ -124,12 +124,16 @@ def stats(args):
def log(args):
if args.clear_log:
pmb.helpers.run.user(args, ["truncate", "-s", "0", args.log], log=False)
pmb.helpers.run.user(args, ["tail", "-f", args.log, "-n", args.lines],
log=False)
def log_distccd(args):
logpath = "/home/user/distccd.log"
if args.clear_log:
pmb.chroot.user(args, ["truncate", "-s", "0", logpath], log=False)
pmb.chroot.user(args, ["tail", "-f", logpath, "-n", args.lines], log=False)
......
......@@ -134,11 +134,10 @@ def arguments():
"log_distccd",
help="follow the distccd logfile")
for action in [log, log_distccd]:
action.add_argument(
"-n",
"--lines",
default="30",
help="count of initial output lines")
action.add_argument("-n", "--lines", default="30",
help="count of initial output lines")
action.add_argument("-c", "--clear", help="clear the log",
action="store_true", dest="clear_log")
# Action: zap
zap = sub.add_parser("zap", help="safely delete chroot folders")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment