Running with -a -y still ends with interaction (pruning images)
dockcheck -a -y after updating ends with:
All done!
Would you like to prune dangling images? y/[n]:
I expect that to happen automatically since I used -y. Not sure if that's even possible?
It was deliberate due to the -p option that will auto-prune, but I realize it's not that intuitive when you choose a "auto" option. To auto-prune right now you'll do dockcheck -yp.
Though when thinking about it, running with -a|-y option should probably skip the prune-interaction and default to "no" prune - I'll consider this change!
(And btw. The -a and -y flag is the same option (if you look at the readme/help) so running both wont make any difference.)
Oh I thought -a was automatic and -y was unattended/no interaction. My actual goal is to make your tool output, part of a monthly maintenance script, for my home server. The script performs a few basic actions (cleaning up, updating the system, updating docker, btrfs filesystem maintenance, remaining space per media folder calculation) and relevant output is added to a textfile, which becomes the body of an email.
Just the "Containers on latest version" and "Containers with updates available" is the output from your tool I want to add to the textfile. Not the actual updating, that would lead to a long and messy email.
So I would run your script twice. Once dockcheck -n > output to textfile and then a second run dockcheck -ap to update and prune automatically :)
Ah yes. I've been considering removing one of the options but I dont want to mess with how people use it.
Sounds interesting with the monthly maintenance script! You could look into the notification-alternatives.
But if you'd just like an output of containers with updates to a file you could probably modify the notify_generic.sh to something like this:
send_notification() {
Updates=("$@")
UpdToString=$( printf "%s\n" "${Updates[@]}" )
FromHost=$(hostname)
# platform specific notification code would go here
printf "\n%bPrinting containers with updates to logfile.\n%b" "$c_green" "$c_reset"
printf "\nContainers with updates on %s:\n%s\n" "$FromHost" "$UpdToString" > /path/to/file/$(date +"%Y%m%d").log
}
Or a static name instead of the date-stamp if you just overwrite it each run.
Place that file as notify.sh alongside the dockcheck script and then run it with dockcheck -iap, the -i for inform, calling the notify.sh
Been a couple of days - have you tried my suggestion @zilexa ?
May I consider this resolved and close it?
I'll probably change the code to skip the prune-interaction (default 'no') when running with -a|-y without -p
yes feel free to close, I have been caught up by work unfortunately. But I will definitely test and use it in the suggested way. A change as you suggest would be a welcome one!