-
Notifications
You must be signed in to change notification settings - Fork 68
Description
dura
can't do anything for you if it's not running. How can we ensure that it's started & always running? I'd like dura
to be nearly invisible after installation. It should "just work".
dura serve
is setup so that the old process will finish it's loop iteration and then terminate. The new process overwrites ~/.config/dura/config.json
with it's PID, and the old process terminates at the beginning of it's next iteration. (dura kill
overwrites the pid with null
, which causes the existing daemon to terminate itself).
Idea: start from ~/.bashrc
or ~/.zshrc
When a new terminal session opens, it runs some file like ~/.bashrc
. Here, we can run dura serve &
to start & demonize it.
To make this work, add this to your ~/.bashrc
or ~/.zshrc
file:
dura serve &
Positives:
- It ensures that the demon starts
- Somewhat easy to setup
Negatives
- It only works if the user uses the terminal. Some people only use Git plugins via their editor.
- Doesn't restart failed daemons
Idea: bash/zsh prompt function
Set the user's prompt function to run dura serve &
. This means it runs after every command
Positives
- Better assurance that the daemon keeps running at the right time
- We can also have the function do
dura watch .
on every directory wecd
to, to ensure all Git repos are watched.
Negatives
- Harder to install (could be mitigated)
- Harder to support more shells
- Only works if the user uses the terminal. Some people only use Git plugins via their editor.
Idea: Git hook
Run dura serve &
and dura watch .
on a global Git hook (e.g. after pull & commit)
Positives
- You generally run
git pull
before doing any work, regardless if you use the Terminal or an IDE plugin - Would target precisely the repos that you actually use.
Negatives
- Hook scripts are exclusive. If you wanted to run other hook scripts, you'd have to shut off the
dura
hooks. - Doesn't include repos that you've already cloned & pulled. So there's a gap between when you install
dura
and when it actually does it's job correctly.