nickmarkfurness
Posts: 5
Joined: Fri Mar 04, 2016 12:39 pm

Jessie - Run .sh after chromium has started

Thu Apr 27, 2017 9:51 am

Hi,

I have a script called refresh.sh which work just fine when i run it manually via the terminal. Code is one line -->

watch -n 5 xdotool search --onlyvisible --class chromium windowactivate key "ctrl+F5"

This then performs a keyboard action CTRL+F5 every 5 seconds. (This will be changed once i have things working)
I want to run this after chromium has started and loaded the page i want in kiosk mode. This works fine too by the way.

I have tried a systemd service but get an error message when i try to start it manually. I have tried using my .py in the service and running the .sh file directly but with no luck. Error message is the same :(

Any help would be appreciated.

/home/pi/refresh.py

import subprocess

subprocess.call(["home/pi/refresh.sh"])

/lib/systemd/system/refresh.service

[Unit]
Description=CareCall Service
After=multi-user.target

[Service]
Type=idle
ExecStart=/home/pi/carecallrefresh.sh

[Install]
WantedBy=multi-user.target

Error:

Loaded: loaded (/lib/systemd/system/refresh.service; enabled)
Active: failed (Result: exit-code) since Thu 2017-04-27 09:31:04 GMT; 3s ago
Process: 2468 ExecStart=/home/pi/refresh.sh (code=exited, status=203/EXEC)
Main PID: 2468 (code=exited, status=203/EXEC)

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Jessie - Run .sh after chromium has started

Thu Apr 27, 2017 8:34 pm

This worked for me.

Code: Select all

#!/bin/bash
lxterminal -e 'chromium-browser --noerordialogs --disable-session-crashed-bubble --disable-infobars --kiosk http://www.google.com'
lxterminal -e 'watch -n 5 xdotool search --onlyvisible --class chromium windowactivate key "ctrl+F5"'

nickmarkfurness
Posts: 5
Joined: Fri Mar 04, 2016 12:39 pm

Re: Jessie - Run .sh after chromium has started

Fri Apr 28, 2017 8:04 am

Is this in the autostart file or a script file you run on boot via the autostart file?

I will take what you have sent and try working it out of course :)

Thanks mate

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Jessie - Run .sh after chromium has started

Fri Apr 28, 2017 11:00 am

~/.config/lxsession/LXDE-pi/autostart
I use a script, but either should work. Add to the end of the file:
@/home/pi/scriptname.sh
Insure there is an '@' before each command in the autostart file.

edit: Insure you change the file attribute to execute on the shell script file.

Return to “Troubleshooting”