Innovenergy_trunk/firmware/opt/innovenergy/scripts/start

21 lines
450 B
Plaintext
Raw Permalink Normal View History

2023-02-16 12:57:06 +00:00
#!/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"