Add `-c, --clear` argument for `log` and `log_distccd` actions to clear log files (#344)
This commit is contained in:
parent
6a129669a3
commit
257666799e
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue