Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleLocal Web Server

I host all ads on a local web server that shares the same network as the kiosk/display (raspberry pi) and Roku TV. This makes it faster to download on first load and saves bandwidth. Along with this I use a script ran from a cron job to turn the screens on and off at a specified time. 

**For some reason I dont want to research now. The first line will uninstall the GUI.** 

Code Block
sudo apt -y install apache2 php7.1 php-memcache php-curl php7.1-sqlite3 libapache2-mod-php php-cli php-json apache2-utils git-all
apt install dbus-user-session gvfs gvfs-backends gvfs-daemons gvfs-fuse libpam-systemd lightdm lxde lxde-core lxpolkit lxsession lxsession-logout openbox-lxde-session packagekit pi-package pi-package-session pipanel piwiz policykit-1 raspberrypi-ui-mods rp-prefapps systemd-sysv udisks2
cd /var/www/html
sudo git clone https://github.com/mjnshosting/FrontStreet.git
sudo chown www-data:www-data -R /var/www/html/FrontStreet
sudo nano /etc/apache2/sites-available/000-default.conf
sudo service apache2 restart

Change DocumentRoot to the following:

Code Block
DocumentRoot /var/www/html/FrontStreet/interface

In browser go to <server name/IP>/8_4o

Code Block
Example: htp://localhost/8_4o


Code Block
cd ~
mkdir -p .local/bin

nano .local/bin/roku_power_cycle.sh

Code Block
#!/bin/bash
Pn='PowerOn'
Pf='PowerOff'
#Array of devices by ip address
declare -a arr=("192.168.2.6" "192.168.2.7")

for devices in "${arr[@]}"
       do (
                TV="http://$devices:8060/keypress/"
                case $1 in
                        -po)
                                curl -d '' $TV$Pn
                                ;;
                        -pf)
                                curl -d '' $TV$Pf
                                ;;
                esac
        )
        done


Code Block
PATH=/home/mjns/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#On at 7AM
0 7 * * * roku_power_cycle.sh -po
#Off at 11PM
0 23 * * * roku_power_cycle.sh -pf 


...