2

So I've got an interesting challenge in front of me, running Ubuntu 16.04.

I originally created a .xsession file that ran Exec=google-chrome --kiosk http://some-url.com to boot as a kiosk device.

The above mentioned .xsession file exists in /usr/share/xsessions/, and is set to the default session in the lightdm config file found at /usr/share/lightdm/lightdm.d.conf/50-ubuntu.conf.

That worked just fine.

On to the new challenge:

I want to be able to remotely toggle whether or not the device boots in kiosk mode.

In an attempt to do this I have modified the Exec command to run a bash script that I've written to determine whether or not to boot as a kiosk.

The following script is executed from the .xsession file:

#! /bin/bash

KIOSK_MODE=$(curl http://some-url.com/bootInKioskMode/)

if [ $KIOSK_MODE = "true" ] ; then
    google-chrome --kiosk http://some-url.com
else
    gnome-session --session=ubuntu &
    unity
fi

The idea is that because I can control what http://some-url.com/bootInKioskMode/ returns, I should be able to toggle what mode the device boots into

As it stands now, I have two problems that I need to solve.

  1. My if/else statement is always matching false...so it is not booting into kiosk mode even if the curl response is true.

  2. When it boots and runs the commands after the else statement, it doesn't really match a default boot. The top menu bar is missing, as well as the icons and settings options on the top right of the screen.

Other things worth mentioning:

  • I do know that it is connected to the internet, and the curl request is firing off ok through testing (having it output and save to a file).

  • I have it setup to auto-login to a kiosk user that does not have sudo permissions, and have been running tests in these conditions.


Any help with this is appreciated. At this point I've spent hours googling and trying out different things and I've yet to have much luck.

Thanks.

0

Re-decompose your problem. You could easily write a simple Perl script to listen to an agreed-upon port (e.g. 30201) See this example from thegeekstuff.com. Have the server part accept 3 commands: "kiosk", "desktop" and "quit". "kiosk" and "desktop" set/clear a flag like /var/run/kiosk-mode. Start the server in /etc/init. Then you can simply if [[ -f /var/run/kiosk-mode ]] ; then ... in your script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.