# Getting a list of activated modules non-interactively

**URL:** https://discuss.tryton.org/t/getting-a-list-of-activated-modules-non-interactively/5139
**Category:** System Administrator
**Created:** [March 29, 2022, 11:05am UTC](https://discuss.tryton.org/t/getting-a-list-of-activated-modules-non-interactively/5139 "2022-03-29T11:05:58Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![gerald\_wiese](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/g/a6a055/32.png) [@gerald\_wiese](https://discuss.tryton.org/u/gerald_wiese)
#### Post date: [March 29, 2022, 11:05am UTC](https://discuss.tryton.org/t/getting-a-list-of-activated-modules-non-interactively/5139/1 "2022-03-29T11:05:58Z")

</div>

Hello,  
for backup purposes on GNU Health I’m looking for a way to get a list of activated modules non-interactively. Can’t find something similar in trytond-admin command. I guess I could find a way on PostgreSQL level. But since the GNU Health client is able to show modules and their state at “Administration → Modules → Modules” there might be an existing option I am missing or maybe someone already wrote a script for this?  
Best  
Gerald

---

<div class="post-metadata">

### Author: ![dalers](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/dalers/32/1767_2.png) [@dalers](https://discuss.tryton.org/u/dalers)
#### Post date: [March 29, 2022, 2:31pm UTC](https://discuss.tryton.org/t/getting-a-list-of-activated-modules-non-interactively/5139/2 "2022-03-29T14:31:43Z")

</div>

You _could_ use trytond-admin with verbosity level 2 to update all activated modules, which outputs the module names (as well as a LOT of other info notices) to stderr.

`(env) [tryton@starlord ~/trytond]$ trytond-admin -vv -c ./trytond.conf -d [database] --all 2> trytond-admin-modules.txt`

I think it should be possible using the unix “cut” command to truncate the output lines after the column containing the module name (i.e. cut out just the first part of each line), then use “sort” and “uniq” to create a simple list of unique module names. However hopefully someone will provide a simpler option.

Dale

---

<div class="post-metadata">

### Author: ![dave](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/d/ee7513/32.png) [@dave](https://discuss.tryton.org/u/dave)
#### Post date: [March 29, 2022, 3:04pm UTC](https://discuss.tryton.org/t/getting-a-list-of-activated-modules-non-interactively/5139/3 "2022-03-29T15:04:53Z")

</div>

Another option may be `trytond-console`, something like:

```
trytond-console -c <tryton.conf> -d <database> <<EOF
Module = pool.get('ir.module')
modules = Module.search([('state', '=', 'activated')])
for module in modules:
    print(module.name)
EOF

```

---

<div class="post-metadata">

### Author: ![nicoe](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/nicoe/32/2880_2.png) [@nicoe](https://discuss.tryton.org/u/nicoe)
#### Post date: [March 29, 2022, 3:07pm UTC](https://discuss.tryton.org/t/getting-a-list-of-activated-modules-non-interactively/5139/4 "2022-03-29T15:07:18Z")

</div>

There are different ways to get the information:

- Using a SQL query to get the information from the `ir_module` table
- Using proteus to make a search on the `ir.module` Model
- Using the update mecanism with a bit of `grep` and `cut` like @dalers hinted

---

<div class="post-metadata">

### Author: ![gerald\_wiese](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/g/a6a055/32.png) [@gerald\_wiese](https://discuss.tryton.org/u/gerald_wiese)
#### Post date: [March 30, 2022, 9:46am UTC](https://discuss.tryton.org/t/getting-a-list-of-activated-modules-non-interactively/5139/5 "2022-03-30T09:46:15Z")

</div>

Thanks a lot, much appreciated! Solution of dave was quite exactly what I was hoping for.  
Had to upgrade vobject to resolve a ValueError but that comes from GNU Health version pinning, gotta take a look why that…

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [April 29, 2022, 9:46am UTC](https://discuss.tryton.org/t/getting-a-list-of-activated-modules-non-interactively/5139/6 "2022-04-29T09:46:20Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
