# Before/after-snapshot-root action isn't reflected in server UI after being set via CLI

**URL:** https://kopia.discourse.group/t/before-after-snapshot-root-action-isnt-reflected-in-server-ui-after-being-set-via-cli/2904
**Category:** Support
**Created:** [May 13, 2024, 8:41pm UTC](https://kopia.discourse.group/t/before-after-snapshot-root-action-isnt-reflected-in-server-ui-after-being-set-via-cli/2904 "2024-05-13T20:41:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rumor](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/rumor/32/1036_2.png) [@rumor](https://kopia.discourse.group/u/rumor)
#### Post date: [May 13, 2024, 8:41pm UTC](https://kopia.discourse.group/t/before-after-snapshot-root-action-isnt-reflected-in-server-ui-after-being-set-via-cli/2904/1 "2024-05-13T20:41:07Z")

</div>

I’ve created an [issue](https://github.com/kopia/kopia/issues/3851) on GH with no response, so maybe here I’ll find the solution:

Kopia 0.17 is installed in the server mode on Ubuntu 23.04.

I’m trying to configure the Kopia via Ansible and Kopia cli and struggling with the ‘policy set’:  
` kopia policy set "user@host:/some/path" --before-snapshot-root-action "/path/to/script.sh script-param1 script-param2"`

After running the above command and looking at the Kopia UI policy page for the ‘user@host:/some/path’ the ‘Before Snapshot’ field (both defined and effective) remains empty no matter what I’ve tried although the 'kopia policy show ’ shows that the before action is correctly set:

```auto
Run command before snapshot root: (defined for this target)
  Command:
    /path/to/script.sh script-param1 script-param2
  Mode: essential
  Timeout: 1m0s

```

The referenced script is running fine when the snapshot is taken, though and I could live with it but when the before/after action is set via CLI these before/after commands are **removed** when the policy is updated via Server UI manually.

On the other hand, if I set the same script but on the Server UI manually it is set correctly and visible in the UI and the snapshot runs successfully. But the `kopia policy show` shows it as an **embedded** script (not as Command as shown above) :

```auto
Run command before snapshot root: (defined for this target)
  Embedded script (stored in repository): <<<<<<<<---------
    /path/to/script.sh script-param1 script-param2
  Mode: essential
  Timeout: 1m0s

```

Looks like a bug. Does anyone have a solution?
