Author Topic: "Headless" Presentation pi with auto update script?  (Read 4511 times)

0 Members and 1 Guest are viewing this topic.

Offline Benaal

  • Jr. Member
  • **
  • Posts: 7
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
"Headless" Presentation pi with auto update script?
« on: May 01, 2014, 11:41:45 am »
Hi all,

Been working with Linux for about a month now - Got my Pi a couple of weeks back and have just about got the hang ofit. I'm now looking to expand the application of the Pi into the business world.

As a brief introduction, our plant has 24 work areas, working 24 hours a day, 365 days a year. Each work area has its' own budget and KPIs.

At present, I construct 24 PPT Presentations, containing KPI Graphs and information - Then save them down as JPG images. Then, because our contractor-managed network utilises symantec endpoint encryption to automatically encrypt anything being saved to USB, Ihave to virtualise Ubuntu, connect to a network share on the host, connect the USB device through Virtualbox, and save to USB stick - Then I have to go round each TV and plug the USB sticks back into the TVs and set the presentation running. It pretty much takes up my entire day.

What I would like to do is run a Pi on each TV, and on each Pi have a cron which initiates a shell script. This shell script, in my mind, would then stop any presentations ongoing, look to my own Ubuntu server on the same network, update it's own apt repository (download the latest slides), then run libreoffice --show /home/slide/slides.odp

Am I thinking along the right lines?

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 18231
  • Karma: 476
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: "Headless" Presentation pi with auto update script?
« Reply #1 on: May 01, 2014, 12:03:09 pm »
Hi Benaal, and welcome to the forum :)

I'm not sure what you mean by update their own apt repository ?

wouldn't running rsync on the Ubuntu server to push sync the contents of its /home/slide directory with the one on the Pi's do the trick ?

then run inotify on the Pi's set to trigger libreoffice --show /home/slide/slides.odp when it notices a change in the contents of the Pi's /home/slide directory

Effectively meaning as soon as you update the slide.odt on the server and run rsync, the updated slides.odt would immediately be pushed to the Pi's and LibreOffice on the Pi's restarted.
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

Offline Benaal

  • Jr. Member
  • **
  • Posts: 7
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Re: "Headless" Presentation pi with auto update script?
« Reply #2 on: May 01, 2014, 02:28:14 pm »
Hi Mark,

Thanks for the quick response. As I said, i've only just started looking into Linux so apologies for my n00b-isms and misplaced terminology when it crops up.

I understand the basics about aptitude reaching out to a server to update the package list, and then update all of the packages installed on that machine (I think, anyway).
My high level hopes were that I could create a repository on my ubuntu server, containing a package for each work area. I would then apt-get install the relevant work area on each pi. My understanding was then that I would run a cron job to update the repository ever 24 hours or so and restart the presentation with the new slides.

I've never seen rsync before, so I will go RTFM on that and inotify, as that seems to be a sensible option (push rather than pull).

Again, thanks for the welcome!

Martin

Offline Mark Greaves (PCNetSpec)

  • Administrator
  • Hero Member
  • *****
  • Posts: 18231
  • Karma: 476
  • Gender: Male
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
    • Awards
Re: "Headless" Presentation pi with auto update script?
« Reply #3 on: May 01, 2014, 04:00:03 pm »
apt repositories are for "package" management .. so unless you want to have to build a .deb package that contains the new file every time, apt isn't the right tool.

If all these Pi's need to have different content for the slide show...

then (on the Ubuntu box) if you automount the Pi's through fstab .. so their /home/slide directories are mounted as local directories .. you could simply place the new slides.odt in the locally mounted folders and they'd be copied to the Pi's

so let's say you have 3 Pi's all on the network with static IP's of say

Pi-1 = 192.168.0.10
Pi-2 = 192.168.0.11
Pi-3 = 192.168.0.12

then you'd create 3 local directories to use as mount points:
sudo mkdir /media/Pi-1
sudo mkdir /media/Pi-2
sudo mkdir /media/Pi-3

then you'd mount them across the network with entries "similar" to these in fstab

//192.168.0.10/home/slide /media/Pi-1 cifs iocharset=utf8,dir_mode=0777,file_mode=0777 0 0
//192.168.0.11/home/slide /media/Pi-2 cifs iocharset=utf8,dir_mode=0777,file_mode=0777 0 0
//192.168.0.12/home/slide /media/Pi-3 cifs iocharset=utf8,dir_mode=0777,file_mode=0777 0 0

Now the folders
/media/Pi-1 on the Ubuntu box is showing the contents of /home/share on Pi-1
/media/Pi-2 on the Ubuntu box is showing the contents of /home/share on Pi-2
/media/Pi-3 on the Ubuntu box is showing the contents of /home/share on Pi-3

so copying the new file to the local directorues would be the same as changing them on the respective Pi

then just use inotify on the Pi's to trigger a restart of the slideshow when it notices the contents of /home/slide changed
WARNING: You are logged into reality as 'root'
logging in as 'insane' is the only safe option.
pcnetspec.co.uk

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal