# Is it possible to pkg update/upgrade all jails in one go?



## blazingice (May 4, 2013)

There is an option to update/upgrade from the host
`#pkg -j <JAIL ID> update/upgrade`

Doing this for every single jail might get a bit tedious.

Is it possible to update/upgrade all jails with just one command? Maybe something like this
`#pkg -j <all> update/upgrade`


----------



## fonz (May 4, 2013)

If not, you could of course write a script for it. Something along the lines of the following:

```
#!/bin/sh

. /etc/rc.conf

for foo in ${jail_list}
do
  pkg -j ${foo} update/upgrade
done
```
The above is untested and written off the top of my head, but you'll get the idea.


----------



## blazingice (May 6, 2013)

Cool. I changed it a bit. It seems to be working.



```
#!/bin/sh

for foo in `jls name`
do
  pkg -j ${foo} upgrade
done
```

I have nothing in /etc/rc.conf because the jails were created with sysutils/ezjail which puts all the details in separate files. Also I discovered that there is no need to run update/upgrade separately. 
`# pkg upgrade` will do an automatic update.


----------

