{
    "mode": "man",
    "parameter": "run-one-constantly",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/run-one-constantly/1/json",
    "generated": "2026-05-30T05:14:58Z",
    "synopsis": "run-one COMMAND [ARGS]\nrun-this-one COMMAND [ARGS]\nrun-one-constantly COMMAND [ARGS]\nkeep-one-running COMMAND [ARGS]\nrun-one-until-success COMMAND [ARGS]\nrun-one-until-failure COMMAND [ARGS]",
    "sections": {
        "NAME": {
            "content": "run-one - run just one instance at a time of some command and unique set of arguments (useful\nfor cronjobs, eg)\n\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "run-one COMMAND [ARGS]\n\nrun-this-one COMMAND [ARGS]\n\nrun-one-constantly COMMAND [ARGS]\n\nkeep-one-running COMMAND [ARGS]\n\nrun-one-until-success COMMAND [ARGS]\n\nrun-one-until-failure COMMAND [ARGS]\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "run-one is a wrapper script that runs no more than one unique instance of some command with a\nunique set of arguments.\n\nThis is often useful with cronjobs, when you want no more than one copy running at a time.\n\nrun-this-one  is  exactly  like run-one, except that it will use pgrep(1) and kill(1) to find\nand kill any running processes owned by the user and matching the target commands  and  argu‐\nments.   Note that run-this-one will block while trying to kill matching processes, until all\nmatching processes are dead.\n\nrun-one-constantly operates exactly like run-one except that it respawns \"COMMAND [ARGS]\" any\ntime COMMAND exits (zero or non-zero).\n\nkeep-one-running is an alias for run-one-constantly.\n\nrun-one-until-success  operates exactly like run-one-constantly except that it respawns \"COM‐\nMAND [ARGS]\" until COMMAND exits successfully (ie, exits zero).\n\nrun-one-until-failure operates exactly like run-one-constantly except that it respawns  \"COM‐\nMAND [ARGS]\" until COMMAND exits with failure (ie, exits non-zero).\n\n",
            "subsections": []
        },
        "EXAMPLE": {
            "content": "In one shell:\n\n$ run-one rsync -azP $HOME $USER@example.com:/srv/backup\nfoouser/\nfoouser/.bashhistory\n40298 100%   37.13MB/s    0:00:00 (xfer#1, to-check=3509/3516)\nfoouser/.viminfo\n20352 100%   98.39kB/s    0:00:00 (xfer#3, to-check=3478/3516)\n...\nsent 746228 bytes  received 413059 bytes  36802.76 bytes/sec\ntotal size is 3732890955  speedup is 3219.99\n\nIn another shell, while the first is still running:\n\n$ run-one rsync -azP $HOME $USER@example.com:/srv/backup\n$ echo $?\n1\n\nAnother example...  In one shell:\n\n$ run-one top\n\nIn another shell:\n\n$ run-one top\n$ echo $?\n1\n$ run-this-one top\ntop - 17:15:36 up  1:43,  3 users,  load average: 1.05, 1.04, 1.00\nTasks: 170 total,   1 running, 169 sleeping,   0 stopped,   0 zombie\n...\n\nAnd note that the process in the first shell was killed.\n\nYou might want to keep one ssh connection up and running all the time, with:\n\n$ run-one-constantly ssh -N -C -L 3128:localhost:3128 -L 7778:localhost:7778 example.com &\n\n\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "flock(1), kill(1), pgrep(1)\n\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "This  manpage and the utility was written by Dustin Kirkland <kirkland@ubuntu.com> for Ubuntu\nsystems (but may be used by others).  Permission is granted to copy, distribute and/or modify\nthis  document  under the terms of the GNU General Public License, Version 3 published by the\nFree Software Foundation.\n\nOn Debian systems, the complete text of the GNU  General  Public  License  can  be  found  in\n/usr/share/common-licenses/GPL, or on the web at http://www.gnu.org/licenses/gpl.txt.\n\n\n\nrun-one                                      9 Jan 2011                                   run-one(1)",
            "subsections": []
        }
    },
    "summary": "run-one - run just one instance at a time of some command and unique set of arguments (useful for cronjobs, eg)",
    "flags": [],
    "examples": [
        "In one shell:",
        "$ run-one rsync -azP $HOME $USER@example.com:/srv/backup",
        "foouser/",
        "foouser/.bashhistory",
        "40298 100%   37.13MB/s    0:00:00 (xfer#1, to-check=3509/3516)",
        "foouser/.viminfo",
        "20352 100%   98.39kB/s    0:00:00 (xfer#3, to-check=3478/3516)",
        "...",
        "sent 746228 bytes  received 413059 bytes  36802.76 bytes/sec",
        "total size is 3732890955  speedup is 3219.99",
        "In another shell, while the first is still running:",
        "$ run-one rsync -azP $HOME $USER@example.com:/srv/backup",
        "$ echo $?",
        "Another example...  In one shell:",
        "$ run-one top",
        "In another shell:",
        "$ run-one top",
        "$ echo $?",
        "$ run-this-one top",
        "top - 17:15:36 up  1:43,  3 users,  load average: 1.05, 1.04, 1.00",
        "Tasks: 170 total,   1 running, 169 sleeping,   0 stopped,   0 zombie",
        "...",
        "And note that the process in the first shell was killed.",
        "You might want to keep one ssh connection up and running all the time, with:",
        "$ run-one-constantly ssh -N -C -L 3128:localhost:3128 -L 7778:localhost:7778 example.com &"
    ],
    "see_also": [
        {
            "name": "flock",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/flock/1/json"
        },
        {
            "name": "kill",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/kill/1/json"
        },
        {
            "name": "pgrep",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/pgrep/1/json"
        }
    ]
}