# Trigger mautic:segments:update when user adds a tag manually via UI

**URL:** <https://forum.mautic.org/t/trigger-mauticupdate-when-user-adds-a-tag-manually-via-ui/24744>\
**Category:** Development\
**Created:** [July 13, 2022, 3:12am UTC](https://forum.mautic.org/t/trigger-mauticupdate-when-user-adds-a-tag-manually-via-ui/24744 "2022-07-13T03:12:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dannyb](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/dannyb/32/7796_2.png) [@dannyb](https://forum.mautic.org/u/dannyb)\
**Post date:** [July 13, 2022, 3:12am UTC](https://forum.mautic.org/t/trigger-mauticupdate-when-user-adds-a-tag-manually-via-ui/24744/1 "2022-07-13T03:12:32Z")

</div>

Hi! I hope you’re well!

My company just decided to use Mautic, and I’ve been assigned to implement it.

(am just in the process of familiarizing with the docs & codebase - so forgive me if any questions seem obviously answered anywhere)

A question from our marketing team was, **is there a way to have a segment updated immediately after they manually add a tag or segement to a contact, as opposed to waiting for cronjobs to run**.

i can see a few potential options - like calling a bash script (containing the mautic:segments:update call) when save method is called… but before i dig any further i thought i’d check if a solution already exists / there is a recommended way to achieve this.

Many thanks & look forward to testing!

---

<div class="post-metadata">

**Author:** ![dannyb](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/dannyb/32/7796_2.png) [@dannyb](https://forum.mautic.org/u/dannyb)\
**Post date:** [July 21, 2022, 6:52am UTC](https://forum.mautic.org/t/trigger-mauticupdate-when-user-adds-a-tag-manually-via-ui/24744/2 "2022-07-21T06:52:34Z")

</div>

ended up just running update:segment more often but using tsp ([Ubuntu Manpage: ts - task spooler. A simple unix batch system](https://manpages.ubuntu.com/manpages/xenial/man1/tsp.1.html)) for all cronjobs so they’re always sequential.

for example, if need to run update segment every 5 min:

_/5_ \* \* \* tsp -n php /var/www/html/mautic/bin/console mautic:segments:update --no-interaction --no-ansi

using tsp has added benefit of no longer have to stagger cronjobs to avoid concurrency.

working nicely so far

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [July 21, 2022, 6:55am UTC](https://forum.mautic.org/t/trigger-mauticupdate-when-user-adds-a-tag-manually-via-ui/24744/3 "2022-07-21T06:55:29Z")

</div>

Iteration for the same topic.  
The one minute version.

[![](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/0/0bc9562b34af41025814bc4c8090ea55addd7d17.jpeg "Smart Segment Processing Script for Mautic") ](https://www.youtube.com/watch?v=Ui-zGW7mYhE)
