Skip to content

Instantly share code, notes, and snippets.

@mwicat
Created March 29, 2012 13:52
Show Gist options
  • Select an option

  • Save mwicat/2237683 to your computer and use it in GitHub Desktop.

Select an option

Save mwicat/2237683 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eu
cmd=$1
do_setup() {
number=$1
port=$2
dest="homes/$number"
rsync -avz tmpl/ "$dest/"
sed -i -e "s/@@NUMBER@@/$number/g" -e "s/@@PORT@@/$port/g" "$dest"/.linphonerc
}
do_start() {
for dir in homes/*/; do
HOME="$dir" linphone-3 &
done
}
do_stop() {
pkill linphone-3
}
case "$cmd" in
start )
do_start
;;
stop )
do_stop
;;
setup )
let port=5060
while read number; do
let port++
do_setup $number $port;
done
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment