

I currently use Tiddlywiki for all my note taking, but I’m about to switch to TriliumNext Notes.
I currently use Tiddlywiki for all my note taking, but I’m about to switch to TriliumNext Notes.
changing how I called ssh
in the background made the difference (https://lemmy.thewooskeys.com/comment/521006).
Thanks for your time and assistance
That seems to have done it!
Running the ssh -f...
instead of ssh.... &
seems to work first time and every time.
It makes it so SSH_PID=$!
doesn’t work, but I used pgrep -f
instead.
Thanks!
I’m not sure how to chain these 2 commands with &&
, because the SSH command is being put in the background with &
.
This doesn’t work:
SSH_CMD="ssh -N -L ${LOCAL_PORT}:127.0.0.1:${REMOTE_PORT} ${REMOTE_USER}@${REMOTE_HOST}"
$SSH_CMD & && TEST=$(curl -o /dev/null -s -k -w "%{http_code}" -u "${USERNAME}:${PASSWORD}" "${URL}/dashboard/")
SSH_PID=$!
SSH_RESULT=$?
echo $TEST
Perhaps I don’t need it in the background - the goal was to establish the tunnel and then continue with the script without it hanging until the ssh command is canceled.
Thanks for the suggestion.
set -x
didn’t reveal any errors, and the commands that it’the script is executing are as I expect them to be.
I did just discover, though, a possible cause for my issue: https://lemmy.thewooskeys.com/comment/520854
I stumbled on a possible cause, but more background is necessary to explain.
The script actually creates an ssh tunnel (to the Traefik host) and then does the curl. So the code is like:
SSH_CMD="ssh -N -L ${LOCAL_PORT}:127.0.0.1:${REMOTE_PORT} ${REMOTE_USER}@${REMOTE_HOST}"
$SSH_CMD &
SSH_PID=$!
SSH_RESULT=$?
TEST=$(curl -o /dev/null -s -k -w "%{http_code}" -u "${USERNAME}:${PASSWORD}" "${URL}/dashboard/")
echo "${TEST}" #debug
What I learned is that when i run the script, the tunnel is successfully created but the curl fails; but then if I run the script again a second tunnel is created and the curl works fine.
So I guess the question is why is curl failing from within the subshell?
Here is the result of the script curling a known good URL (it still results in exit code 7 and thus a result of “000”), followed by a copy-paste of the curl command run in the shell (exited with “200”):
$ ./test.sh
curl -o /dev/null -s -k -w "%{http_code}" "https://i0.wp.com/www.notquitezen.co/wp-content/uploads/2022/07/Is-Happiness-an-Emotion.png"
previous exit code: 7
000
$
$ curl -o /dev/null -s -k -w "%{http_code}" "https://i0.wp.com/www.notquitezen.co/wp-content/uploads/2022/07/Is-Happiness-an-Emotion.png"
200
Thanks for the suggestions.
The script is pulling the values of USERNAME and PASSWORD from a .env. I added debug echo $USERNAME $PASSWORD
in the script and it shows the correct values, so the script is pulling the values correctly and storing them in the vars correctly. I also added that echo to the subshell command, like:
TEST=$(echo $USERNAME)
echo $TEST
…and the result was the correct USERNAME.
The script does begin with .
echo $PATH; which curl
produces identical results when run from the shell and the script.
Thanks for the suggestion. I just tried it and the result is the same. :(
Ah!
TEST=$(curl -o /dev/null -s -k -w "%{http_code}" -u "${USERNAME}:${PASSWORD}" "${URL}/dashboard/#/http/routers")
echo "previous exit code: $?" #debug
echo "${TEST}" #debug
This outputs:
previous exit code: 7
000
Is $?
referring to the exit command of the curl in the subshell? Or is it referring to the assignment of the subshell’s output to the TEST var?
Thanks for the suggestion. I already tried this: echo-ed the curl command to stdout and then in the shell copied it and pasted it to run it. From the script I get “000”, from the shell I get “200”.
Thanks for that info, @AtariDump@lemmy.world
I highly recommend OPNsense over pfSense for the UI improvements alone, but there are other reasons to use/support OPNsense over pfSense.
Can you list or summarize some of the other reasons?
Before Linux command line?
I host tt-rss in docker and use Tiny Tiny RSS in GrapheneOS.
When I install qbittorrent via docker, I see this in the docker logs:
qbittorrent-1 | 2024-11-04T15:25:25.201955254Z The WebUI administrator username is: admin
qbittorrent-1 | 2024-11-04T15:25:25.201974066Z The WebUI administrator password was not set. A temporary password is provided for this session: H7ct3xPes
That’s the default admin credentials for the instance. I can then change the login or pw in the UI.
Thanks for sharing about Backrest. I use Restic and Backrest looks like a great addition to it.
I should add the d.rymcg.tech includes step-ca if you want to host your own CA server, but I agree with @joe@discuss.tchnic.de : it’s not necessary for securely hosting services, and ir can be dangerous I’d not done carefully.
I love homepage for this purpose. Gorgeous, good UX, easy to configure, and lots of widgets/integrations.