Closed rahul-thakoor closed 5 years ago
Hi Rahul
Good to hear of someone else using Tohora and balenaDash.
So I'm trying to understand you here. You're writing a script and you want to access the parameters (the URL)? I think inside your script you want to be using $1
. See https://www.lifewire.com/pass-arguments-to-bash-script-2200571
Then, to pass the URL to tohora running on your balenaDash device, use curl
. You'll need to make a POST
request using -d
and some data.
Does that help to point you on the right direction?
Here's an example curl
command for when you get on to that part:
curl -d "url=http://example.com/your-url-here/" http://address.of.your.device:8080/launch/
hey Richard Yes I am doing that but $1
is always empty for some reason :(
It sounds like your problem is in the realm of scripting, not tohora related. I'm keen to help you use tohora but I'm, well, I'm not an expert on bash/shell scripts. You might have better luck elsewhere trying to get the $1
issue solved. One approach I would suggest: break it down. Can you write a script that simply echos the first parameter back, like this?
$ cd /tmp
$ cat > myscript.sh
#!/bin/sh
echo $1
$ chmod +x myscript.sh
$ ./myscript.sh 'hello, world'
hello, world
Thanks for getting back promptly Richard. Indeed, I already tested something like that. The thing is when I call it directly it works but when tohora calls the script with the URL it doesn't
Anyway, I will try to find a way. Thanks. Will keep you posted
Wait, I think I understand you now: so you're starting tohora
and passing something other than WPELauncher
? That ought to work, I think, if you start tohora like this: tohora 80 your_script.sh
Although I've never tested it that way. Possibly the way tohora
starts a subprocess doesn't create a shell or something. (code is in https://github.com/mozz100/tohora/blob/master/subprocess/subprocess.go)
What do the logs say (the output of tohora
)?
I think that's the issue.
I just checked, and I am getting this: fork/exec /home/chromium/launch.sh: permission denied
permission denied
- you did make your script executable, right? chmod +x
or similar
Please share your whole script and the exact steps you are following to obtain that message. Even then I'm not sure I'll be able to help, I'm afraid.
It seems to work by adding -
(make login shell) when starting chromium from the script
Thanks a lot, Richard! That was helpful
I was doing this:
echo "chromium --kiosk --app=$1 --window-size=$WINDOW_SIZE --start-fullscreen" >> /home/chromium/xstart.sh
su -c 'startx /home/chromium/xstart.sh -- -nocursor' chromium
I changed the last line to :
su -c 'startx /home/chromium/xstart.sh -- -nocursor' - chromium
Not entirely sure if that's what was causing the issue tbh. But it doesn't seem to be related to tohora, so im closing this. Sorry for the noise Richard
Hey there! Thank you so much for this awesome tool.
I am trying to use it in combination with a bash script. The idea is to pass the URL to the script which then starts chromium.
It calls the script:
Running '/home/chromium/launch.sh https://akirodic.com/p/jellyfish/'
but, the script cannot find the argument. I think it should be called like this/home/chromium/launch.sh "<URL>"
. Any idea how I can solve this? Thanks