diff --git a/README.md b/README.md index 725f0d1..2ef8ea2 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,7 @@ The environment variables are analogous to the script's command line arguments. | API_KEY | no | The Immich API Key to use. Either `API_KEY` or `API_KEY_FILE` must be specified. The `API_KEY` variable takes precedence for ease of manual execution, but it is recommended to use `API_KEY_FILE`. | API_KEY_FILE | no | An absolute path (from the root of the container) to a file containing the Immich API Key. The file might be mounted into the container using a volume (e.g. `-v /path/to/api_key.secret:/immich_api_key.secret:ro`). The file must contain only the value. | | CRON_EXPRESSION | yes | A [crontab-style expression](https://crontab.guru/) (e.g. `0 * * * *`) to perform album creation on a schedule (e.g. every hour). | +| RUN_IMMEDIATELY | no | Set to `true` to run the script right away, after running once the script will automatically run again based on the CRON_EXPRESSION | | ALBUM_LEVELS | no | Number of sub-folders or range of sub-folder levels below the root path used for album name creation. Positive numbers start from top of the folder structure, negative numbers from the bottom. Cannot be `0`. If a range should be set, the start level and end level must be separated by a comma.
Refer to [How it works](#how-it-works) for a detailed explanation and examples. | | ALBUM_SEPARATOR | no | Separator string to use for compound album names created from nested folders. Only effective if `-a` is set to a value `> 1`(default: "` `") | | CHUNK_SIZE | no | Maximum number of assets to add to an album with a single API call (default: `2000`) | diff --git a/docker/setup_cron.sh b/docker/setup_cron.sh index 114b673..0efe50f 100644 --- a/docker/setup_cron.sh +++ b/docker/setup_cron.sh @@ -1,5 +1,9 @@ #!/usr/bin/env sh - +if [ ! -z "$RUN_IMMEDIATELY" ]; then + if [ "$RUN_IMMEDIATELY" = "true" ] || [ "$RUN_IMMEDIATELY" = "1" ]; then + UNATTENDED=1 /script/immich_auto_album.sh > /proc/1/fd/1 2>/proc/1/fd/2 || true + fi +fi if [ ! -z "$CRON_EXPRESSION" ]; then CRONTAB="$CRON_EXPRESSION UNATTENDED=1 /script/immich_auto_album.sh > /proc/1/fd/1 2>/proc/1/fd/2" # Reset crontab