toggle-pypo-debug.sh 956 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. if [[ $EUID -ne 0 ]]; then
  3. echo "This script must be run as root." 1>&2
  4. exit 1
  5. fi
  6. usage () {
  7. echo "Use --enable <user> or --disable flag. Enable is to set up environment"
  8. echo "for specified user. --disable is to reset it back to pypo user"
  9. }
  10. if [ "$1" = "--enable" ]; then
  11. /etc/init.d/airtime-playout stop
  12. /etc/init.d/airtime-playout start-liquidsoap
  13. user=$2
  14. echo "Changing ownership to user $1"
  15. chmod -R a+rw /var/log/airtime/pypo
  16. chmod a+r /etc/airtime/airtime.conf
  17. chown -Rv $user:$user /var/tmp/airtime/pypo/
  18. chmod -v a+r /etc/airtime/api_client.cfg
  19. elif [ "$1" = "--disable" ]; then
  20. user="pypo"
  21. echo "Changing ownership to user $1"
  22. chmod 644 /etc/airtime/airtime.conf
  23. chown -Rv $user:$user /var/tmp/airtime/pypo/
  24. chmod -v a+r /etc/airtime/api_client.cfg
  25. /etc/init.d/airtime-playout stop-liquidsoap
  26. /etc/init.d/airtime-playout start
  27. else
  28. usage
  29. fi