forked from JiriSko/amixer-webui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
amixer-webui_openwrt
executable file
·61 lines (55 loc) · 1.27 KB
/
amixer-webui_openwrt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh /etc/rc.common
#
# File: /etc/init.d/amixer-webui
# Date: 11. 7. 2016
# Author: Jiri Skorpil <jiri.sko@gmail.com>
# Desc.: procd init script for start/stop ALSA Mixer WebUI webserver on OpenWrt
#
EXTRA_COMMANDS="status"
START=99
STOP=0
path=/usr/share/amixer-webui
alsa_path=/var/lib/alsa
asound=asound.state
pid="`ps w | grep alsamixer_webui | grep -v grep | awk '{print $1}'`"
start() {
if [ "$pid" != "" ]
then
echo "amixer-webui already running"
else
cd $path
$path/alsamixer_webui.py >/dev/null 2>&1 &
if [ ! -f "$alsa_path/$asound" ]; then
if [ ! -d "$alsa_path" ]; then
mkdir $alsa_path
fi
if [ -f "$path/$asound" ]; then
cp $path/$asound $alsa_path/$asound
alsactl restore
else
alsactl init
fi
fi
echo "amixer-webui started"
fi
}
stop() {
if [ "$pid" != "" ]
then
kill -9 $pid > /dev/null 2>&1
if [ -f "$path/$asound" ]; then
cp $alsa_path/$asound $path/$asound
fi
echo "amixer-webui stopped"
else
echo "amixer-webui is not running"
fi
}
status() {
if [ "$pid" != "" ]
then
echo "amixer-webui is running"
else
echo "amixer-webui is not running"
fi
}