| 1 |
.. cyrusman:: cyr_withlock_run(8) |
| 2 |
|
| 3 |
.. author: Bron Gondwana |
| 4 |
|
| 5 |
.. _imap-reference-manpages-systemcommands-cyr_withlock_run: |
| 6 |
|
| 7 |
==================== |
| 8 |
**cyr_withlock_run** |
| 9 |
==================== |
| 10 |
|
| 11 |
is used to run system command with a lock held |
| 12 |
|
| 13 |
.. warning:: |
| 14 |
|
| 15 |
This command runs as the Cyrus user, so if you need to call something |
| 16 |
as root, the cyrus user may need sudo privileges. |
| 17 |
|
| 18 |
Synopsis |
| 19 |
======== |
| 20 |
|
| 21 |
.. parsed-literal:: |
| 22 |
|
| 23 |
**cyr_withlock_run** [ **-C** *config-file* ] [ **-u** *userid* ] cmd args... |
| 24 |
|
| 25 |
Description |
| 26 |
=========== |
| 27 |
|
| 28 |
**cyr_withlock_run** will run the command and arguments provided on the |
| 29 |
command line, either locking the entire server, or a particular user, so |
| 30 |
no changes can be made to it while this command is running. |
| 31 |
|
| 32 |
WARNING: since this takes an exclusive lock, it will deadlock if the command tries |
| 33 |
to connect to Cyrus via IMAP/JMAP/etc and run commands that take exclusive locks. |
| 34 |
You can run cyrus commandline tools so long as the environment is passed through. |
| 35 |
|
| 36 |
It is most useful for running an external filesystem snapshot command, which can |
| 37 |
be run safely, knowing that files aren't in a partial state. |
| 38 |
|
| 39 |
|
| 40 |
**cyr_withlock_run** |default-conf-text| |
| 41 |
|
| 42 |
Options |
| 43 |
======= |
| 44 |
|
| 45 |
.. program:: cyr_withlock_run |
| 46 |
|
| 47 |
.. option:: -C config-file |
| 48 |
|
| 49 |
|cli-dash-c-text| |
| 50 |
|
| 51 |
.. option:: -u, --user <userid> |
| 52 |
|
| 53 |
Lock just the specified userid rather than the global lock. |
| 54 |
|
| 55 |
NOTE: if you run for the global lock, then your server must have the |
| 56 |
`global_lock` config option set, or this command will fail with an |
| 57 |
error as it can't get a guaranteed lock. |
| 58 |
|
| 59 |
Examples |
| 60 |
======== |
| 61 |
|
| 62 |
.. parsed-literal:: |
| 63 |
|
| 64 |
**cyr_withlock_run** sleep 300 |
| 65 |
|
| 66 |
.. |
| 67 |
|
| 68 |
Pause all writes on the server for 300 seconds (stops any writes from getting locks) |
| 69 |
|
| 70 |
Files |
| 71 |
===== |
| 72 |
|
| 73 |
/etc/imapd.conf |
| 74 |
|
| 75 |
|
| 76 |
Environment |
| 77 |
=========== |
| 78 |
|
| 79 |
Sets the `CYRUS_HAVELOCK_GLOBAL` or `CYRUS_HAVELOCK_USER` environment variables, |
| 80 |
to tell any called cyrus command that this lock is already held. |
| 81 |
|
| 82 |
See Also |
| 83 |
======== |
| 84 |
|
| 85 |
:cyrusman:`imapd.conf(5)` |