Hi, Ok, I found my very quick, dirty and non-functional example shell script printing out an ordered list of saved ConnMan services. It most likely won't work properly or at all, so someone should definitely fix it with better shell syntax and usability if considered for any real world use.
It of course uses internal information from save files and will break the very moment ConnMan makes changes to its internal behavior. Cheers, Patrik # # Connection Manager # # Copyright (c) 2014, Intel Corporation. # # This program is free software; you can redistribute it and/or modify it # under the terms and conditions of the GNU General Public License, # version 2, as published by the Free Software Foundation. # # This program is distributed in the hope it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. # echo "Remove this line in order to run the shell script" && exit 1 saved_services=${CONNMAN_SAVED_SERVICES:-/var/lib/connman} usage () { echo "Find last N services saved by ConnMan" echo "$(basename $0) [--last|--keep <N>]" echo " --last N\tPrint the N last service save dirs" echo " \t\tPrint the N oldest service save dirs when N < 0" echo " --keep N\tPrint the service save dirs starting with the Nth newest" exit 2 } find_all () { while read savefile do settings="$savefile/settings" test -r "$settings" || continue modified=$(grep Modified "$settings") echo $modified $settings done } find_last () { last=$1 if [ "$last" -ge 1 ] then find_all | sort -r | head -n "$last" elif [ "$last" -lt 0 ] then find_all | sort -r | tail -n "$last" else find_all | sort -r fi } find_older () { keep=$1 find_all | sort -r | tail -n +$((keep +1)) } find_save () { last=$1 keep=$2 ( if [ $keep -ne 0 ] then find_older $keep else find_last $last fi ) | while read date_str file_str do ## echo $date_str $(dirname "$file_str") echo $(dirname "$file_str") done } test -d "$saved_services" || exit 1 which find > /dev/null || exit 1 last=0 keep=0 while test -n "$1" do case "$1" in --last) shift last="$1" ;; --keep) shift keep=$1 ;; *) usage ;; esac test -n "$1" && shift done test $keep -ne 0 -a $last -ne 0 && usage find "$saved_services" -mindepth 1 -type d | \ find_save $last $keep exit 0 _______________________________________________ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman