Closed simonkub closed 3 years ago
Can you try an absolute path (replacing the ~ with /Users/user, assuming the script is indeed executable) or bash=/bin/bash param1=path/to/script
?
If you want it in a single script, try something like this:
if [ "$1" = action ]; then
wget -bqO- http://rpi.local/php/send.php --post-data "steckdose=1_1_1" &>/dev/null
return
fi
echo "Boxen an | bash=$0 param1=action terminal=false"
ls -l
says its executable
-rwxr-xr-x 1 sim staff 129 13 Aug 09:26 1_1_1.sh
Changing ~to the absolute path doesn't change anything. Moving the command in the plugin itself with yout snippet doesn't work, too.
I don't get why it "needs" the terminal output to run, even if wget is mutet with the -bO
.
Try curl
maybe?
curl -s --data "steckdose=1_1_1" http://rpi.local/php/send.php
I tried curl
before trying it with wget
, but I also had no luck there.
If I find some time later, I'm tying to get it to work with php and/or php-curl. I'll keep you updated.
I have a similar issue. I have a python script that executes a few different applescripts. When terminal=false
is set, the scripts do not run. When terminal=true
they run just fine. Executing the command inside a terminal session works. I've tried using a bash string instead of string formatting. Executing the scripts in applescript editor works. Executing them via the python environment works. And executing them via zsh works. So the issue seems to be bitbar, not the scripts. As @simonkub mentioned, I'd tried rewriting the script to call itself, then call applescript, and it makes no difference.
Likewise, here's a few snippets:
youtubeClick = '/Users/rjadmin/Documents/automation/youtube_play_pause.applescript'
print '{0} | bash=osascript param1={1} param2={2} terminal=true refresh=true'.format(title, youtubeClick, url)
@robertjacobson Try /usr/bin/osascript
or which osascript
instead of just osascript
.
tldr: @iosdeveloper that worked, thank you!
I could've swore I tried that, but I must've tried it before when I was sending the parameters as a single string. Thanks.
I had the same issue with a node script. Setting the option terminal="false"
did not run the script in the background.
This is a solution:
console.log(`Run in background | terminal="false" bash="/usr/local/bin/node" args="/Users/user/work/bitbar/myplugin/file.js__351760"`)
Note that arguments are separated by __
(double underscore).
If this is applicable to other languages, it should be documented.
I had the same issue with a node script. Setting the option
terminal="false"
did not run the script in the background.This is a solution:
console.log(`Run in background | terminal="false" bash="/usr/local/bin/node" args="/Users/user/work/bitbar/myplugin/file.js__351760"`)
Note that arguments are separated by
__
(double underscore).If this is applicable to other languages, it should be documented.
After hours of search for solution, this thread finally solved my problem.
bumped into this as well, but I'm not sure how to get it to work, even with @napravicukod workaround... If I run with terminal=true
it works fine, with terminal=false
it doesn't (and obviously there's no easy way to debug without the terminal).
I'm trying something very simple, to allow me to toggle the bitbar state via touch
ing and rm
ing a flag file, so script looks like this more or less (simplified)
#!/bin/bash
if [ -f ~/tmp/flag ]; then
echo "."
echo ---
echo 'resume |terminal=false refresh=true bash="rm ~/tmp/flag"'
exit 0
fi
# plugin code here
echo ---
echo 'pause |terminal=false refresh=true bash="touch ~/tmp/flag"'
hardcoding the full path (instead of ~
) doesn't seem to help either.
Any tips on how to make this work with terminal=false
?
found a workaround here, which feels a bit odd, but seems to work. So my script to pause/resume a plugin looks like this now
#!/bin/bash
if [[ "$1" = "pause" ]]; then
touch ~/tmp/flag
fi
if [[ "$1" = "resume" ]]; then
rm ~/tmp/flag
fi
if [ -f ~/tmp/flag ]; then
echo "."
echo ---
echo "resume |terminal=false refresh=true bash=$0 param1=resume"
exit 0
fi
# plugin code here
echo ---
echo "pause |terminal=false refresh=true bash=$0 param1=pause"
Hi!
I'm trying to start a bashscript with bitbar, which then runs a wget post request on a webserver in my local network. The problem is, that as soon as I set
terminal=false
wget is not executed. While it works withterminal=true
or when starting the script from terminal I can't get it running trough bitbar.The line in the bitbar-plugin:
and 1_1_1.sh (which is executable) :
I also tried running the wget command directly from bitbar with specifying the parameters with
param1=foo
but it results to the same behavior.Has anyone an idea?