October 17, 20232 yr I've been able to bulk upload photos to Immich manually through the command line by going to my Docker tab, finding the Immich container, clicking ">_ Console" and running the command: immich upload --key HFEJ38DNSDUEG --server http://192.168.1.216:2283/api --recursive directory/ This works fine, but I'd like to automate this using userscripts so that it runs automatically from time to time. I don't know much about writing scripts though - I've tried a few things but haven't gotten it to work. If I click the ">_" button at the top of my GUI for the UNRAID terminal, and run: docker exec -it immich bash I can get into the docker container, so my userscript looks like this: #!/bin/bash docker exec -it immich bash immich upload --key HFEJ38DNSDUEG --server http://192.168.1.216:2283/api --recursive directory/ When I run that though I get the error: Quote the input device is not a TTY /tmp/user.scripts/tmpScripts/immich test/script: line 3: immich: command not found I've also tried running: docker exec -it immich upload --key HFEJ38DNSDUEG --server http://192.168.1.216:2283/api --recursive directory/ but get an error message telling me that the upload command is not found. I'm pasting in the generic 'immich upload' command from the Immich website, the command that I'm running has my correct API key, IP address & upload source directory. Can anyone suggest a way to set up my user script so that I can run it on a schedule to grab any photos that I put into the upload source directory? Another item that I'm concerned about once I get the first part running - when I run the immich upload command through the docker console, there is a message that says something like 'you're about to upload ### photos, are you sure?' and then I have to enter y/n. Is there a way to make sure that the user script can confirm 'y' for me? Edited October 17, 20232 yr by romain added more details.
June 1, 20242 yr In case anybody else winds up here looking for a solution--I was able to get this working with a couple of changes to romain's script: #!/bin/bash docker exec immich bash docker exec immich upload --recursive directory/ The changes were 1) removing the "-it" flags, which are for interactive use (not a script) and 2) adding the docker exec command before the upload command. I didn't need to pass the server address or API key, because those are permanently stored in an auth.yml file that was created after I ran the following command, which was only needed once: immich login http://192.168.0.45:8080/api [API key] The upload command doesn't display a progress bar when it is running, but it does complete the upload. Edited June 1, 20242 yr by MastodonFarm
December 29, 20241 yr I have a quick question just to make sure i understand. #!/bin/bash docker exec immich bash docker exec immich upload --recursive directory/ "directory/ " would be the path of where the photos/videos that I want to upload are located? #!/bin/bash docker exec immich bash docker exec immich upload --recursive /user/folders/pictures/ or do I need to keep "directory/ " and the path follows the ending / ?
December 29, 20241 yr Community Expert ? if the docker and data are on unraid why not add a path Example docker variable: -v /upload:/mnt/user/picture then call the imichi upload pointing at /upload immich is still a bit new for me. I've been playing around with it with a friend. if you followed space invaders videos to install imichi then this folder in the template should already exist: -- the libraries folder path.... then the script can point into the docker to that folder path... Edited December 29, 20241 yr by bmartino1 Data - typo
December 29, 20241 yr Community Expert To automate the upload process for Immich in Unraid with a userscript, you can address the two issues you encountered: ... Handling non-TTY errors and command not found: You don't need to start an interactive session (bash) inside the container. Use docker exec directly to run the immich command. ...a bit harder but possible... Automating the confirmation step: You can use yes to automatically send "y" responses to the command. #!/bin/bash # Variables CONTAINER_NAME="immich" UPLOAD_DIRECTORY="/path/to/your/upload/source" API_KEY="HFEJ38DNSDUEG" SERVER_URL="http://192.168.1.216:2283/api" # Run the upload command within the container docker exec $CONTAINER_NAME immich upload \ --key $API_KEY \ --server $SERVER_URL \ --recursive $UPLOAD_DIRECTORY <<< "y" Steps to Configure: Replace placeholders: Replace /path/to/your/upload/source with the absolute path inside the container (e.g., /photos or /libraries as configured in your volume mappings). Replace HFEJ38DNSDUEG with your actual API key. Replace http://192.168.1.216:2283/api with your Immich server URL. Save this script in the User Scripts plugin in Unraid, ensuring the path to the script is correct. --set and use cron via the userscript plugin. Notes: Ensure the immich binary is available in the container. If not, check the Immich documentation or support for enabling this. If the <<< "y" doesn't work (unlikely), consider using yes y | before the command. #!/bin/bash # Variables CONTAINER_NAME="immich" UPLOAD_DIRECTORY="/path/to/your/upload/source" API_KEY="HFEJ38DNSDUEG" SERVER_URL="http://192.168.1.216:2283/api" # Run the upload command within the container, piping 'yes' to confirm yes y | docker exec $CONTAINER_NAME immich upload \ --key $API_KEY \ --server $SERVER_URL \ --recursive $UPLOAD_DIRECTORY Edited December 29, 20241 yr by bmartino1
July 12, 2025Jul 12 This works for me:docker exec immich immich login http://192.168.1.24:8080/api ANTDH19gwRb4EeOH9I0B7BZmOPGW # Upload de bestanden docker exec immich immich upload --recursive --delete /libraries docker exec immich immich logout(no, this is not my actual ip or api-key)
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.