write_file_content
Write or update configuration files in authorized directories, creating a timestamped backup before overwriting to ensure safe changes.
Instructions
Atomically write or update a configuration file within authorized directories.
Creates an automatic timestamped backup (.bak.) before overwriting. Permitted directories: /etc/nginx/, /etc/mysql/, /etc/postgresql/, /etc/docker/, /etc/caddy/, /var/www/
Args: file_path: Path to the target configuration file. content: Text content to write. backup: Create a backup file before writing (default: True).
Returns: JSON string indicating write status and backup location.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| backup | No | ||
| content | Yes | ||
| file_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |