mynttt / UpdateTool

A tool to update the IMDB ratings for Plex libraries that contain movies/series and use the IMDB agent to receive ratings
GNU General Public License v3.0
257 stars 12 forks source link

Running without docker on Linux #70

Closed ronilaukkarinen closed 3 years ago

ronilaukkarinen commented 3 years ago

Hello. I'm on a system with Plex and java installed but without docker or systemd. Is there a step by step tutorial for getting this to run on Linux without docker present?

ronilaukkarinen commented 3 years ago

Any quick hands-on info about this? Please? 🥺

mynttt commented 3 years ago

Hi!

You can run it the following way:

Download the latest version of the tool here: https://github.com/mynttt/UpdateTool/releases/latest

Now create a script like this runner.sh:

#!/bin/bash

# Must point to a java installation >= java 11
JAVA="/usr/bin/java"

# Points to the tool jar file
TOOL_JAR="/mnt/c/Users/myntt/Downloads/UpdateTool-1.5.8.jar"

# Change to 512m or 1g if tool crashes with out of memory exception
JVM_MAX_HEAP="-Xmx256m"

## Run batch processing every hours
RUN_EVERY_N_HOURS="12"

# Set environment variables (must be exported for each var): See https://github.com/mynttt/UpdateTool#environment-variables-guide

## REQUIRED: Data dir
PLEX_DATA_DIR="/mnt/c/Users/myntt/Dev/resources/Plex Media Server"
export PLEX_DATA_DIR

## Optional: Tmdb api key if exists else remove from script
TMDB_API_KEY="abcdefg...."
export TMDB_API_KEY

# add other environment vars that you need in the same manner here

$JAVA -Xms64m "${JVM_MAX_HEAP}" -XX:+UseG1GC -XX:MinHeapFreeRatio=15 -XX:MaxHeapFreeRatio=30 -jar "${TOOL_JAR}" imdb-docker "{schedule=$RUN_EVERY_N_HOURS}"

Be aware the the tool will create files to persist state in the directory that this script is run from. So better create a dir to place it in to, to not end up with files where they should not belong. You can stop the tool via CTRL+C. If you want to run it in the background you could do the following:

cd folderWithTheScript
screen -S updatetool
./runner.sh
# Now press CTRL+A+D to detach from screen 

and to access the screen again:

screen -r updatetool

A log will also be created in the folder where the script is run. Let me know how it works out!

ronilaukkarinen commented 3 years ago

@mynttt Nice, thank you so much! Works brilliantly. 👍

ronilaukkarinen commented 3 years ago

Trying to setup a service without docker, got a weird issue:

2021-09-23 11:44:43.426096150  Exception in thread "main" java.nio.file.AccessDeniedException: ./mitigations.json
2021-09-23 11:44:43.426769589   at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
2021-09-23 11:44:43.426871198   at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
2021-09-23 11:44:43.426966608   at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
2021-09-23 11:44:43.427020691   at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
2021-09-23 11:44:43.427099587   at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:478)
2021-09-23 11:44:43.427171493   at java.base/java.nio.file.Files.newOutputStream(Files.java:220)
2021-09-23 11:44:43.427246171   at java.base/java.nio.file.Files.write(Files.java:3425)
2021-09-23 11:44:43.427320669   at java.base/java.nio.file.Files.writeString(Files.java:3641)
2021-09-23 11:44:43.427396638   at updatetool.common.KeyValueStore.dump(KeyValueStore.java:38)
2021-09-23 11:44:43.427468239   at updatetool.Mitigations.executeMitigations(Mitigations.java:18)
2021-09-23 11:44:43.427532612   at updatetool.Main.main(Main.java:60)

Any idea what causes this?

ronilaukkarinen commented 3 years ago

Related to this perhaps:

Be aware the the tool will create files to persist state in the directory that this script is run from. So better create a dir to place it in to,

ronilaukkarinen commented 3 years ago

Answering to myself:

In service script changed this

bash /home/appbox/appbox_installer/UpdateTool/runner.sh

To this:

cd /home/appbox/appbox_installer/UpdateTool/ bash runner.sh

🎉

titooo7 commented 2 years ago

Hi there, how could I add the variables UNLOCK_FOR_NEW_TV_AGENT and CAPABILITIES to the script?

mynttt commented 2 years ago

@titooo7

You could do it like this:

#!/bin/bash

# Must point to a java installation >= java 11
JAVA="/usr/bin/java"

# Points to the tool jar file
TOOL_JAR="/mnt/c/Users/myntt/Downloads/UpdateTool-<CURRENT_VERSION_HERE>.jar"

# Change to 512m or 1g if tool crashes with out of memory exception
JVM_MAX_HEAP="-Xmx256m"

## Run batch processing every hours
RUN_EVERY_N_HOURS="12"

# Set environment variables (must be exported for each var): See https://github.com/mynttt/UpdateTool#environment-variables-guide

## REQUIRED: Data dir
PLEX_DATA_DIR="/mnt/c/Users/myntt/Dev/resources/Plex Media Server"
export PLEX_DATA_DIR

## Optional: Tmdb api key if exists else remove from script
TMDB_API_KEY="abcdefg...."
export TMDB_API_KEY

# add other environment vars that you need in the same manner here
UNLOCK_FOR_NEW_TV_AGENT="1;2"
export UNLOCK_FOR_NEW_TV_AGENT

CAPABILITIES="NO_MOVIE"
export CAPABILITIES

$JAVA -Xms64m "${JVM_MAX_HEAP}" -XX:+UseG1GC -XX:MinHeapFreeRatio=15 -XX:MaxHeapFreeRatio=30 -jar "${TOOL_JAR}" imdb-docker "{schedule=$RUN_EVERY_N_HOURS}"
titooo7 commented 1 year ago

Thanks!