1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,15 @@ |
1 |
+__mpd_host="${MPD_HOST:-mpd.$(dnsdomainname)}" |
|
2 |
+__mpd_port="${MPD_PORT:-6600}" |
|
3 |
+[ "$__mpd_host" != 'mpd.' ] || return 0 |
|
4 |
+ |
|
5 |
+__mpd_ssh_command='ssh' |
|
6 |
+if [ "$(command -v autossh)" ] |
|
7 |
+then |
|
8 |
+ __mpd_ssh_command='autossh -M 0' |
|
9 |
+fi |
|
10 |
+__mpd_ssh_arguments="-N -L localhost:6600:localhost:$__mpd_port $__mpd_host" |
|
11 |
+ |
|
12 |
+if ! pgrep -f "/$__mpd_ssh_command *$__mpd_ssh_arguments$" > '/dev/null' |
|
13 |
+then |
|
14 |
+ $__mpd_ssh_command -f $__mpd_ssh_arguments |
|
15 |
+fi |