mkunit edit
Edit a unit file in your preferred editor.
mkunit edit <name> [flags]
Description
The edit command opens a unit file in your editor for manual modifications.
After you save and close the editor, mkunit automatically runs daemon-reload
to pick up the changes. Optionally, it can restart the service to apply changes immediately.
Arguments
| Argument | Description |
|---|---|
<name> |
Name of the unit (with or without extension) |
Flags
| Flag | Description | Default |
|---|---|---|
--system |
Edit a system unit (requires sudo) | false |
--restart |
Restart the unit after editing | false |
--no-reload |
Skip daemon-reload after editing | false |
--editor <path> |
Use this editor instead of $EDITOR | $EDITOR |
Editor Selection
mkunit uses the following order to determine which editor to use:
--editorflag if provided$VISUALenvironment variable$EDITORenvironment variablenano(fallback)
Examples
Edit a user service
mkunit edit myapp
Edit and restart
mkunit edit myapp --restart
Edit a system service
sudo mkunit edit nginx --system --restart
Use a specific editor
mkunit edit myapp --editor vim
Edit a timer unit
mkunit edit backup.timer
Workflow
When you save the file, mkunit validates the syntax before running daemon-reload. If validation fails, you'll be prompted to fix the errors or discard changes.
See Also
- mkunit show - View unit file contents
- mkunit validate - Validate unit files
- mkunit status - Check unit status