Innovenergy_trunk/firmware/opt/innovenergy/scripts/start

21 lines
450 B
Bash
Executable File

#!/bin/bash
abort() {
echo -e "$1"
exit 1
}
[ $# -gt 0 ] || abort "no service specified"
service=$(echo "$1" | sed -E 's#/?service/##' )
matches=$(ls /service/ | grep "$service")
n_matches=$(ls /service/ | grep "$service" | wc -l)
[ "$n_matches" -gt 0 ] || abort "no service matching $service"
[ "$n_matches" -lt 2 ] || abort "multiple services matching $service\n$matches"
echo "starting $matches"
/usr/bin/svc -u "/service/$matches"