Automating old Boot Environment Cleanup Solaris 11

I'm trying to automate the patching process using scripts and cronjobs in Solaris 11.

one of the things I'd like to do is cleanup the old boot environments.

unfortunately

beadm destroy

requires a response

:~$ pfexec beadm destroy -f solaris-13
Are you sure you want to destroy solaris-13?  This action cannot be undone(y/[n]):

I've checked the man pages and even with a -f/F it still requires a response.

Anyone got any handy ideas on how to deal with the programmatically?

thanks

Jim

If a single prompt is issued, or if there are several prompts and they all require a "y" response, you can invoke it in a pipeline reading output from the yes utility.

1 Like

so I tried the obvious

:~$ pfexec beadm destroy -f solaris-13|yes

but that did not appear to work.

can you give an example of correct usage?

thanks I've never heard of yes before.

As Don Cragun is offline, may I jump in? Reverse the pipe commands' sequence:

yes | pfexec beadm destroy -f solaris-13
2 Likes