Files
Iris/mopidy_iris/system.sh

56 lines
1.3 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
2020-02-11 09:53:58 +13:00
if [ -f "/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
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
2020-02-10 07:21:16 +13:00
echo "sudo python3 -m pip install --upgrade mopidy-iris"
UPGRADE="$(sudo python3 -m pip install --upgrade mopidy-iris)"
fi
echo -e "${UPGRADE}"
elif [[ $1 = "restart" ]]; then
if $IS_CONTAINER; then
2020-01-03 06:01:36 +13:00
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
START=$(date +%s)
if $IS_CONTAINER; then
if [ -n "$IRIS_CONFIG_LOCATION" ]; then
SCAN=$(mopidy --config $IRIS_CONFIG_LOCATION local scan)
else
SCAN=$(mopidy --config /config/mopidy.conf local scan)
2023-09-20 15:41:44 +09:30
fi
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 "Completed in $(($(date +%s) - $START)) seconds"
2020-01-03 06:01:36 +13:00
elif [[ $1 = "check" ]]; then
echo -e "Access permitted"
elif [[ $1 = "test" ]]; then
2020-02-13 16:59:35 +13:00
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