major changes

- Added documentation via mdbook
- Created basic VS code extension
- Implemented if else blocks and changed some syntax
- fixed some issues
This commit is contained in:
2025-11-02 19:56:26 +01:00
parent 78959d4f22
commit af0a1632c0
40 changed files with 14014 additions and 177 deletions

View File

@@ -0,0 +1,51 @@
# System Maintenance
> ⚠️ This documentation is AI-generated and may contain errors.
Example system maintenance script demonstrating permission checks, environment variables, and log rotation.
## Script
See the full script in `/examples/system_maintenance.rsh` in the repository.
```rush
#!/usr/bin/env rush
HOSTNAME = "prod-server-01"
MAX_DISK_USAGE = "85"
LOG_DIR = "/var/log"
BACKUP_DIR = "$HOME/backups"
echo "System Maintenance Script"
echo "Running on: $HOSTNAME"
echo "User: $USER"
# Permission-aware execution
if $IS_ROOT {
echo "Running with root privileges"
for check in disk memory services {
echo "Checking $check status..."
if $check {
echo " ✓ $check is healthy"
}
}
} else {
echo "Running as $USER (limited permissions)"
echo "Some checks may be skipped"
}
# Log rotation planning
echo "Preparing log rotation in $LOG_DIR"
for days in 1 7 30 {
LOG_ARCHIVE = "$BACKUP_DIR/logs-$days-days-old.tar.gz"
echo "Would archive logs older than $days days to $LOG_ARCHIVE"
}
```
## Key Concepts
- **Permission-aware execution**: Different behavior for root vs normal user
- **String interpolation**: Building paths with `$HOME`, `$USER`
- **Loops for maintenance tasks**: Iterating over checks and retention periods