# HG changeset patch # User Alain Leufroy # Date 1616194031 -3600 # Fri Mar 19 23:47:11 2021 +0100 # Node ID 252c5ab163a56328d31b7702b3f694baa0cd0be6 # Parent 718318dc13885fc000f60bf8fe1c374c601ad866 status: add status command Simply call the `systemctl status` command for both automount and mount units. diff --git a/overlayctl b/overlayctl --- a/overlayctl +++ b/overlayctl @@ -781,6 +781,18 @@ ''')) +def statuser(name): + layer = build_layer(name) + if not layer.is_managed(): + logger.error('Not found.') + return + Popen(['systemctl', 'status', layer.automountunit.path.name], stdout=sys.stdout).wait() + print('') + Popen(['systemctl', 'status', layer.mountunit.path.name], stdout=sys.stdout).wait() + # print(layer.mountunit.status()) + + + def deplacer(oldname, newname, interrupt=False, preserve=False): # Checks _new = Layer(newname) @@ -1084,6 +1096,26 @@ show.set_defaults(func=_shower) + # status + status = subparser.add_parser( + 'status', + help="Status of the overlay layer", + description="Display the effective status of the layer." + ) + status.add_argument( + 'mountdir', + metavar='MOUNTDIR', + help=( + "overlay mount point. If just a name (without any \"%s\"), " + "it is assumed to be %s/{MOUNTDIR}" % (os.path.sep, MOUNTDIR) + ), + ) + + def _statuser(args): + statuser(args.mountdir) + + status.set_defaults(func=_statuser) + # edit edit = subparser.add_parser( 'edit',