Files
Iris/mopidy_iris/system.sh

52 lines
1.1 KiB
Bash
Raw Normal View History

#!/bin/bash
if [ -f "/var/lib/mopidy/IS_CONTAINER" ]; then
IS_CONTAINER=true
2019-11-07 17:01:27 +13:00
else
IS_CONTAINER=false
2019-11-07 17:01:27 +13:00
fi
if [[ $1 = "upgrade" ]]; then
2019-11-07 17:01:27 +13:00
if [[ $IS_CONTAINER ]]; then
echo "cd /iris && git checkout master && git pull origin master"
UPGRADE="$(cd /iris && git checkout master && git pull origin master)"
else
echo "sudo pip install --upgrade mopidy-iris"
UPGRADE="$(sudo pip install --upgrade mopidy-iris)"
fi
echo -e "${UPGRADE}"
elif [[ $1 = "restart" ]]; then
2020-01-03 06:01:36 +13:00
if [[ $IS_CONTAINER ]]; then
echo -e "Cannot restart Mopidy when running in a Docker container"
exit 1
else
RESTART="$(sudo service mopidy restart)"
echo -e "${RESTART}"
fi
2018-11-02 16:10:38 +13:00
elif [[ $1 = "local_scan" ]]; then
2019-11-07 17:01:27 +13:00
if [[ $IS_CONTAINER ]]; then
SCAN="$(mopidy --config /config/mopidy.conf local scan)"
2019-11-07 17:01:27 +13:00
else
SCAN="$(sudo mopidyctl local scan)"
2019-11-07 17:01:27 +13:00
fi
echo -e "${SCAN}"
2020-01-03 06:01:36 +13:00
elif [[ $1 = "check" ]]; then
echo -e "Access permitted"
elif [[ $1 = "test" ]]; then
sleep 3
2020-01-17 17:01:24 +13:00
TEST=$(echo "Hello, this is your bash speaking. I was sleeping for 3 seconds. Is running a container: $IS_CONTAINER")
2018-11-02 16:10:38 +13:00
echo -e "${TEST}"
2019-04-04 14:37:40 +13:00
else
2019-04-04 14:37:40 +13:00
echo -e "Unsupported system task"
2020-01-03 06:01:36 +13:00
exit 1
fi
exit 0