diff --git a/pmb/helpers/frontend.py b/pmb/helpers/frontend.py index 91b95882..37ffa0d6 100644 --- a/pmb/helpers/frontend.py +++ b/pmb/helpers/frontend.py @@ -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) diff --git a/pmb/parse/arguments.py b/pmb/parse/arguments.py index b4f5bbed..6cc52f59 100644 --- a/pmb/parse/arguments.py +++ b/pmb/parse/arguments.py @@ -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")