|
@@ -507,7 +507,7 @@ check_ssh_nc() {
|
507
|
507
|
port=22
|
508
|
508
|
fi
|
509
|
509
|
|
510
|
|
- rep="$(nc -q1 z3.zered.net $port </dev/null)"
|
|
510
|
+ rep="$(nc -q1 $host $port </dev/null)"
|
511
|
511
|
res=$?
|
512
|
512
|
if [ "$res" -ne "0" ]
|
513
|
513
|
then
|
|
@@ -554,4 +554,29 @@ check_ssh_key() {
|
554
|
554
|
logdate ERR "Received : $key" 1
|
555
|
555
|
return
|
556
|
556
|
fi
|
|
557
|
+
|
|
558
|
+check_mpc() {
|
|
559
|
+ # check_mpc [$host [$port] ]
|
|
560
|
+ # tests if you can contact an MPD server in a client way
|
|
561
|
+ # returns the current state of the server
|
|
562
|
+
|
|
563
|
+ host=$1
|
|
564
|
+ port=$2
|
|
565
|
+
|
|
566
|
+ if [ -z "$host" ]
|
|
567
|
+ then
|
|
568
|
+ host=127.0.0.1
|
|
569
|
+ fi
|
|
570
|
+
|
|
571
|
+ if [ -z "$port" ]
|
|
572
|
+ then
|
|
573
|
+ port=6600
|
|
574
|
+ fi
|
|
575
|
+
|
|
576
|
+ if echo "status" | nc -w 1 "$host" "$port" | head -1 | grep "^OK MPD"
|
|
577
|
+ then
|
|
578
|
+ success "MPD server can be contacted on $host:$port"
|
|
579
|
+ status=$(echo "status" | nc -w 1 "$host" "$port" | grep "^state:"|cut -d: -f2)
|
|
580
|
+ success "It's state is : $status"
|
|
581
|
+ fi
|
557
|
582
|
}
|