0 Followers
0 Following
1 Posts
Bash scripting question - sh.itjust.works

Hello everyone, Hoping that this is a good place to post a question about Bash scripting. My wife and I have run into a problem in PhotoPrism where it keeps tagging pictures and videos with similar names together and so the thumbnail and the video do not match. I decided that rather than try to get her iPhone to tweak its naming it’s easier to just offload to a directory then rename every file to a UUID before sending to photoprism. I’m trying to write a bash script to simplify this but cannot get the internal loop to fire. The issue appears to be with the ‘while IFS= read -r -d ‘’ file; do’ portion. Is anyone able to spot what the issue may be? bash #! /bin/bash echo "This script will rename all files in this directory with unique names. Continue? (Y/N)" read proceed if [[ "$proceed" == "Y" ]]; then echo "Proceed" #use uuidgen -r to generate a random UUID. #Currently appears to be skipping the loop entirely. the find command works so issue should be after the pipe. # Troubleshooting #Seems like changing IFS to $IFS helped. Now however it's also pulling others., don't think this is correct. #verified that the find statement is correct, its the parsing afterwards that's wrong. #tried removing the $'\0' after -d as that is string null in c. went to bash friendly '' based on https://stackoverflow.com/questions/57497365/what-does-the-bash-read-d-do #issue definitely appears to be with the while statement find ./ -type f \( -iname \*.jpg -o -iname \*.png \) | while IFS= read -r -d '' file; do echo "in loop" echo "$file" #useful post https://itsfoss.gitlab.io/post/how-to-find-and-rename-files-in-linux/ #extract the directory and filename dir=$(dirname "$file") base=$(basename "$file") echo "'$dir'/'$base'" #use UUID's to get around photoprism poor handling of matching file names and apples high collision rate new_name="$dir/$(uuidgen -r)" echo "Renaming ${file} to ${new_name}" #mv "$file" "$new_name" #uncomment to actually perform the rename. done echo "After loop" else echo "Cancelling" fi

Using the nginx reverse proxy manager on the Raspberry Pi has fully resolved my issue. The conflict of being hosted on the NAS was the problem. Hopefully this proves helpful to one or two other folks!

So I’m still not sire why jellyfin and photoprism work but I have a theory that the problem is that nginx is deployed on my Asustor NAS. I’ve found a few things indicating that because the NAS requires ports 80 and 443, services like nginx struggle to capture the requests and route them correctly.

I did try mapping nginx to use 444 and 380 instead but was unsuccessful. I believe this is because incoming traffic is on the default port 80 http port. I don’t know that its feasible to capture requests indicating my domain name and somehow have the NAS route only those through to inside the nginx container.

My next step will be trying to deploy nginx reverse proxy on a raspberry pi and then manage traffic from there.

So I’m still not sire why jellyfin and photoprism work but I have a theory that the problem is that nginx is deployed on my Asustor NAS. I’ve found a few things indicating that because the NAS requires ports 80 and 443, services like nginx struggle to capture the requests and route them correctly.

I did try mapping nginx to use 444 and 380 instead but was unsuccessful. I believe this is because incoming traffic is on the default port 80 http port. I don’t know that its feasible to capture requests indicating my domain name and somehow have the NAS route only those through to inside the nginx container.

My next step will be trying to deploy nginx reverse proxy on a raspberry pi and then manage traffic from there.

Challenges getting reverse proxy working with homebox

https://sh.itjust.works/post/45741197

Challenges getting reverse proxy working with homebox - sh.itjust.works

Question for folks and a note. I’m struggling with a similar issue as the one below for a couple of services so this may not just be a homebox item but rather a PEBKAC issue. I’ve got NGINX proxy manager set up and directing to homebox. I’m using the sub-domain ‘homebox.mydomain.tld’ and have SSL certificates etc already configured for all sub domains. Homebox is configured to be accessed on port 3100 and is installed on a docker. My docker containers are managed by portainer and so I’ve set the environment to access any of my containers via ‘http://portainer.mydomain.tld/: [http://portainer.mydomain.tld/:]<port>’. That works like a charm any time I go directly to that link. I then have configured ‘homebox.mydomain.tld’ to point to ‘http://portainer.mydomain.tld:3100/ [http://portainer.mydomain.tld:3100/]’ . It uses my SSL certificate but does not force ssl. I’ve also enabled websockets support. This however doesn’t work and the access hangs. The reason I’m posting here to ask if I may have missed a configuration on homebox that is necessary is that other containers such as Photprism and Jellyfin which I use the same structure for work with no trouble. Anyone have some ideas you could share? Even if its an RTFM and you can point me to a good manual I’d be happy with the help.

Appreciate everyone’s help. What I ended up doing was moving to porkbun as I (a) saved money with some of the whois privacy items, (b) got free SSL certificates, and © it worked with the automated certbot tie in with Nginx-Prox-Manager. I did confirm I could manually load certs into Nginx but have very limited time at the moment and this seemed like a straightforward path.

Certainly the proposals for self-hosted DNS servers are interesting and something I may experiment with in the future but times limited at the moment. Now I’m just working out why Jellyfin and Photoprism work perfectly but homebox doesn’t want to work with the domain name. Another round of learning begins!

Second set of eyes - DNS Nameservers

https://sh.itjust.works/post/44903707

Second set of eyes - DNS Nameservers - sh.itjust.works

Hello all, I’m looking for a second set of eyes before I potentially screw up all my self hosted services. I’ll be the first to admit I’m not an IT expert and am getting a wee bit lost in all of the reading I’ve been doing so please go easy on me. I’m currently working to get my domain (already registered) to be used for internal addresses as well as get a working SSL certificate. I am following wolfgangs instructions [https://notthebe.ee/blog/easy-ssl-in-homelab-dns01/] with the exception that I already have my domain registered with BlueHost. BlueHost does not appear to be directly supported by nginx and wants to charge me $90/year for an SSL certificate which is far more than I’m willing to pay for my little self-hosting hobby. Fundamentally I believe I need to point my domain to new nameservers which provide support for ‘Let’s Encrypt’. If there were a vendor that offered that as a service I think I could leave the domain with bluehost and simply point the nameservers elsewhere. I “think” cloudflare offers this but its the only one and I’ve heard mixed things about using it from the standpoint of privacy. Does anyone have suggestions? The other option I see, which seems more broadly supported, is to transfer my domain from bluehost to another vendor. Does anyone have suggestions? I’ve struggled to see the renewal costs when looking at these transfers. Before fully borking my setup, would appreciate some input on if I’m on the right track or not. Thank you!

How dependent on framework is the repair basis?

https://sh.itjust.works/post/34666863

How dependent on framework is the repair basis? - sh.itjust.works

I’m looking into a new laptop and really like what I see from framework. One point I’m concerned about is buying into a repairable system but being wholly reliant on a small relatively new player to continue providing specially modularized parts (e.g. the USB modules). Is this concern valid or is there something I’m overlooking? Side question: has anyone had luck with PopOS on a framework?