Skip to content

Instantly share code, notes, and snippets.

@luochen1990
Created November 12, 2021 07:03
Show Gist options
  • Save luochen1990/f0580df615a69b2f888e0e8320d23bde to your computer and use it in GitHub Desktop.
Save luochen1990/f0580df615a69b2f888e0e8320d23bde to your computer and use it in GitHub Desktop.
带多个daemon进程的测试脚本的写作模板
#!/usr/bin/env bash
#So that directories are relative to current file path instead of cwd
#Ref: https://stackoverflow.com/questions/242538/unix-shell-script-find-out-which-directory-the-script-file-resides
cd $(dirname $0)
cd ./server
#Start multiple daemon processes and kill them all in one shot
#Ref: https://stackoverflow.com/questions/3004811/how-do-you-run-multiple-programs-in-parallel-from-a-bash-script
(trap 'kill 0' SIGINT EXIT;
./sdk/gateway &
./sdk/nameserv --server-id ns1 &
./src/main.py &
sleep 3 && ../client/src/main.py
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment