jdownloader2-headless/startJD2.sh
thelittlefireman 7cbcde75f8 fix somtimes force to jdownloader user
Exemple on synology docker interface env variable can't be empty and even if i put 0 to UID and GID this script force to "jdownloader user" and after that i've got some error (cannot access to download directory)
2017-09-30 16:23:52 +02:00

36 lines
532 B
Bash
Executable file

#!/bin/bash
function stopJD2 {
PID=$(cat JDownloader.pid)
kill $PID
wait $PID
exit
}
if [ "$GID" ] && [ "$GID" -ne "0" ]
then
GROUP=jdownloader
groupadd -g $GID $GROUP
else
GROUP=root
fi
if [ "$UID" ] && [ "$UID" -ne "0" ]
then
USER=jdownloader
useradd -r -N -s /bin/false -u $UID $USER
else
USER=root
fi
useradd -G $GROUP $USER
chown -R $USER:$GROUP /opt/JDownloader
trap stopJD2 EXIT
su -c "java -Djava.awt.headless=true -jar /opt/JDownloader/JDownloader.jar &" -s /bin/bash $USER
while true; do
sleep inf
done