Skip to content

Instantly share code, notes, and snippets.

@runekaagaard
Last active April 26, 2021 14:17
Show Gist options
  • Save runekaagaard/57cb1dee53a122301ca1c6a125437de0 to your computer and use it in GitHub Desktop.
Save runekaagaard/57cb1dee53a122301ca1c6a125437de0 to your computer and use it in GitHub Desktop.
Run multiple dev servers in parallel with a single command. Each line has a colored prefix. CTRL+C closes all. Requires GNU parallel.
#!/bin/bash
# COLOR CODES
# Red 31 41
# Green 32 42
# Yellow 33 43
# Blue 34 44
# Magenta 35 45
# Cyan 36 46
# White 37 47
# Reset 0 0
# More at https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797
sag() {
/home/r/.bender_venvs/sag/bin/python /home/r/ws/sag/src/manage.py runserver |& sed 's/^/\x1b[33m[sag] \x1b[0m/'
}
syarn() {
cd /home/r/ws/sag/src
yarn watch |& sed 's/^/\x1b[36m[yarn] \x1b[0m/'
}
hypergen() {
/home/r/ws/venv-hypergen/bin/python /home/r/ws/django-hypergen/examples/manage.py runserver 127.0.0.1:8002 |& \
sed 's/^/\x1b[32m[hypergen] \x1b[0m/'
}
hparcel() {
cd /home/r/ws/django-hypergen/hypergen/static/hypergen/
parcel watch -o hypergen.min.js -d . hypergen.js |& cat | ts '%Y-%m-%d %H:%M:%S' \
| sed 's/^/\x1b[35m[parcel] \x1b[0m/'
}
export -f sag syarn hypergen hparcel
parallel -u ::: sag syarn hypergen hparcel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment