Skip to content

Commit

Permalink
Add Python example
Browse files Browse the repository at this point in the history
  • Loading branch information
pka committed Oct 11, 2024
1 parent 8d979a0 commit e8fc272
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<div class="oranda-hide">

# Shell Compose

</div>

Shell Compose is a lightweight background process runner for long-running or scheduled jobs.

![Shell Compose](https://raw.githubusercontent.com/pka/shell-compose/main/screencast.gif)

## Features

<pre>
* Scheduling
- [x] Run background jobs from the command line
- [x] Run multiple jobs in parallel
Expand All @@ -27,6 +32,7 @@ Shell Compose is a lightweight background process runner for long-running or sch
- [x] Linux
- [x] MacOS
- [x] Windows
</pre>

## Integration with `just`

Expand All @@ -48,14 +54,16 @@ processing:
done
echo Processing finished

# Play sounds from MQTT queue
# Serve current directory on port 8000
[group('autostart')]
play:
#!/usr/bin/env bash
set -euo pipefail
mosquitto_sub -t room/speaker | while read sound; do
aplay sounds/$sound
done
serve:
#!/usr/bin/env python3
import http.server
server_address = ('localhost', 8000)
Handler = http.server.SimpleHTTPRequestHandler
with http.server.HTTPServer(server_address, Handler) as httpd:
print("Server started at http://%s:%s" % server_address, flush=True)
httpd.serve_forever()
```

Running a `just` recipe:
Expand Down

0 comments on commit e8fc272

Please sign in to comment.