I’m trying to have a button on a webpage, hosted on my raspberry Pi, shutdown a QNAP via a script. The script works when I run it from the pi command line. I’ve tested it. I can also see the html page is working, to a point where the key is added to the url when I click the button.
Tag: bash
why is curl waiting for a keypress?
I simply want to run the following command: It seems to connect just fine, but it hangs waiting for a keypress. How can I automatize this in a script? EDIT: I have absolutely no idea but it solved by erasing the — part of the URL. Can someone explain to me why? Answer In bash, you must use quotes (single
How to propagate colors from bash script to CI (GitHub Actions, Travis, Gitlab…)?
I’m using GitHub Actions in CI. When I run commands directly in YAML recipe: the output is colored: But then when I run the same command inside a bash script: It’s without colors: How can I propagate the colors through bash script to the CI output? Answer To enable colors, include this line in the bash script file: Cherry pick
Unable to redirect output from bash
I’m trying to run a command through PHP for a project and have the output redirected to a file. On PHP, I’m creating a string and running the shell_exec() function with the string as a parameter: To be able to run things as root through PHP and shell_exec, I use the following: An example of this is as follows: (See
CGI web application, struggle with variables
this is my first post here. Been reading stackoverflow for a long time and i want to take a time to appreciate everything you do to help community. Thank you. A lack of knowledge in scripting area leads me to creating this post. Due to complication of my problem (in my opinion) i wasnt able to google the solution. First
Bash trap command failing to catch fatal php script exit code 255
Minimal example of the issue: #!/bin/bash errHandler() { echo “Something went wrong. Exiting now.” exit 1 } trap ‘errHandler’ ERR INT pi_process () { bin/pi $@ echo $? } pi_process …
Forward slash in Bash on Mac
I have this bash(version 3.2 on MacOS) function What it’s suppose to do is run phpunit with proper regex, here i am converting * to (.)* and wrapping filter to be case insensitive. Now The problem is that parsed command works perfectly fine(matched test cases run), when i run directly at terminal. But it does not when function rtf tries
Executing bash script with PHP, and input commands
I`m trying to execute a bash script using PHP, but the problem is that the script needs to have some commands and informations inputed during the execution process. This is what I`m using The script execute OK, but I`m not able to input any option on the script. Answer shell_exec() and exec() are not able to run interactive scripts. For
Reading user command line input with PHP with readline, but bash is not default shell
I wrote a PHP script and I’m trying to read user input from the command line. I started of with which worked fine, but when typing the input the arrow keys didn’t work the way it should. I learned that this could be solved with the -e switch, so it became: Now this worked like a charm in my development
How to test if composer.lock is up to date?
During development (multiple people in the team) sometimes composer install returns: Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them. Is there a way to check for this very quickly (in milliseconds, without making any changes)? I understand how composer works. However when