Under review

Script for Ubooquity 2.0.2 on Synology

Elouan 7 years ago updated by anonymous 6 years ago 36


in case somebody requires an update of the script for running ubooquity 2.0.2 on a synology NAS, here is mine. The procedure of installation is already described in the tutorial (look in the FAQ). This script is meant to go in :


This is tested and it's working on my Synology DS212 [the NAS is quite old but it's still able to run ubooquity without (much) issue]

Here is the code, don't forget to adapt to your environnement, especially the installation folders: WORK_DIR, PCKG_DIR

and network and memory settings

# app settings

#     Ubooquity
# description: upstart job configuration file for automatically
#   starting ubooquity when syno starts
# title  :ubooquity.conf
# date  :16 05 2017
# version : 2.0.2 (tested for ubooquity version...)
# original source: ubooquity forum about special characters
#   http://ubooquity.userecho.com/topic/907059-comics-not-imported-umlaut-mark-bug/

description "start/stop Ubooquity"
author "Elouan Le Bretton"
version "Ubooquity Version 2.0.2; java version 1.8.0_121 "

# automatically start ubooquity after webserver has been started
# DSM 5.0 = httpd-user (apache); DSM 6.0 = nginx
start on started nginx

# stop ubooquity on
stop on runlevel [06]

# Automatically respawn if ubooquity stops unexpetedly
respawn limit 5 500
# expect stop [this seems to be expected sometime but requires testing to be sure)

# run the scripts as the 'http' user; because running as root (the default) is a bad idea.
setuid http

 # installation settings
 # app settings

 # This ensures that ubooquity reads special characters properly
 export LANG
 # Main command for ubooquity
 exec "$JAVA_DIR/java" -Dfile.encoding=$ENCO -Xmx$MEM -jar $PCKG_DIR/$PCKG_BIN --libraryport $PORT --workdir "$WORK_DIR"  --adminport $ADMINPORT --remoteadmin --headless
end script

I want to add a comment on the best way to run ubooquity on Synology: lately Synology has added the possibility to create and run scripts from within the GUI: we can define scripts and tell the NAS to run them at run time, before shut down, or periodically... this would be a perfect place to tell the NAS to run ubooquity at run time

This new feature would avoid ssh the NAS, manipulate the file system and we have to vi the conf file, with all the complexity it has for non-linux users: it's a lot simpler to create the script directly from that GUI.

My guess is that copying this code in the panel Synology has created for us would work, but I haven't tested this since I'm happy with how my script is working; but I believe it would be better to manage the script directly from the GUI, it might be safer too....

If someone feels like testing this new method for running ubooquity and let us know how it goes, it would be neat :-)

Under review

Thanks for the info !



on my syno, i have this  : 

planned task gui , and option select on boot

easy for update, juste change ubooquity.jar on folder 

kill process and restart task

export LC_ALL=fr_FR.utf8
export LANG=fr_FR.utf8
/var/packages/Java8/target/j2sdk-image/bin/java -Dfile.encoding=UTF-8 -Xmx2048m -jar /volume1/ubooquity/Ubooquity.jar  --adminport 2502 --headless --libraryport 2202 --remoteadmin  --workdir "/volume1/ubooquity"


I've done a little digging about the planned task feature, and I've decided to go with it instead of continuing with upstart scripts

Here is what I've done:

  1. create a task in "planned tasks" with 2 options
    1. launch on boot
    2. use a script ubooquity.sh file from one of my shared folder
  2. create a file ubooquity.sh in designated shared folder
My "ubooquity.sh" file reads like this:

# installation settings
# app settings
# This ensures that ubooquity reads special characters properly
#export LC_ALL=fr_FR.utf8
export LANG=fr_FR.utf8
$JAVA_BIN -jar $PCKG_BIN --adminport $ADMINPORT --libraryport $PORT --workdir $WORK_DIR --remoteadmin --headless

This way, it's extremely easy to modify the script: you don't even need to go in admin panel in DSM, just modify the file and restart the NAS. Also, a bash file allows a bit more flexibility

Is there a way to make ubooquity drop a process id file somewhere?

Ubooquity is a process like any other, so I guess you could do it like that:




yes of course! This is my new script

echo "Ubooquity task manager script"
#nom du fichier enregistrant le pid de ubooquity au lancement
# installation settings
# app settings

# This ensures that ubooquity reads special characters properly
#export LC_ALL=fr_FR.utf8
export LANG=fr_FR.utf8

#Command line for launching ubooquity
echo "Starting the Ubooquity server"
$JAVA_BIN -jar $PCKG_BIN --adminport $ADMINPORT --libraryport $PORT --workdir $WORK_DIR --remoteadmin --headless & UBOOQUITY_PID=$!
echo "The server has been started with pid $UBOOQUITY_PID ."
exit 0

Perfect Elouan! Thanks!

I applied on my new Synology DS216Play and it worked.

Maybe to be highlighted for beginner profiles:

- PID_FILE: to be adapted to where you created the ubooquity.pid file (which you have to create yourself)

- PCKG_BIN: your proposal is based on former tuto in help section. If you don't (need to) ssh anymore in your synology, then there is no way to add the Ubooquity jar elsewhere than volume1 ;-) => adapt to where you stored the jar

- WORK_DIR: also to be adapted to where you want ubooquity to store all preferences/system/cache files. It is recommended to be another folder than the one storing your comics (to not mix comics & ubooquity system files)

Note: I was initially tricked by the JAVA_BIN, believing I should adapt to the address provided in the java packet settings. Not, you need to keep the one in Elouan script. 

Tom, by the way, the howto should be updated, it is even not valid anymore. Thanks

If you are talking about the Synology tutorial, it was not written by me (I don't have any NAS), so I wouldn't know what to update.

The good news is I moved the documentation to Github a while ago, so anybody can submit pull requests to update the tutorials. ;)


The script is working for me.

Is there a way to set the memory used by java ?

i understand that you set the MEM argument to 512 (for exemple) but this argument is not used in the launch command line.

moreover, when opening a comic online, the cpu utilization of my DS214+ is at 100% and the process takes time. I assume it is when the comic is uncompressed. Do you think that more memory can make this process faster ?

thank you for reading  (and of course thank you for Ubooquity)


right! I forgot about the memory parameter. I belive it's only important if you have an old synology: I've just upgraded to DS216+ with 1Go of RAM, and this parameter is not as important as before (DS212 with 256Mo)

anyway: replace the current line 

$JAVA_BIN -jar $PCKG_BIN --adminport $ADMINPORT --libraryport $PORT --workdir $WORK_DIR --remoteadmin --headless & UBOOQUITY_PID=$!

with the new one

$JAVA_BIN -Xmx$MEM -jar $PCKG_BIN --adminport $ADMINPORT --libraryport $PORT --workdir $WORK_DIR --remoteadmin --headless & UBOOQUITY_PID=$!

About cpu utilization and the time it takes to open a comic, I've found that reading online large file takes a lot of time -even with my new NAS- but only the first 3 or 4 pages, I don't understand why 5i can undertand that it takes a long time to get to the first page, maybe a little more to cache the next pages, but after that... I don't know)

increasing memory can only help, but you'll have to tell me if it's useful: I didn't do any testing on that. besides if you leave the memory parameter blank this allow java to use as much memory as the system allows, meaning that setting the parameter can only reduce the amount of memory ubooquity will use, so I'm not sure this will help, but let me know if you feel different

Thank you. The memory parameter works. Indeed it does not change anything. I have 1024m on my 214+ and set it to 1024m.

the times to open a CBR or  a CBZ and to display the first pages are really too long (almost 2 min per page). I had this problem with ver. 1 too. i wanted to try again with the ver. 2 but it s the same. It s not a problem of transfer  because when i chose download, it takes 5 seconds to download.

The very first versions of Ubooquity (the ones without the sandglass) were buggy but the the display was fast.

Regards and thanks again for your work

Hi there,

I have Ubooquity running on a DS 214+ since 2 years.. After not visiting the admin-page for a while I saw the Update Notification vor Version 2.1 today and performed the update.

Unfortunately now I got 2 problems: The old ubooquity.conf will not start the server at all and my old scheduled tasks will also not work. I tried any solution given in this thread to no effect.

I can start Ubooquity manually with java -jar Ubooquity.jar  but then the GUI is somehow crooked and it does not save the options I am selecting, no folders or anything.

Any Suggestions?

Kind regards

You need to change the .conf file. Myself i did a complete reinstallation on a new folder (workdir parameter) and used the script provided above

Thanks for the reply....finally figured it out aproximately 1h ago...one spelling error in the java-dir...thanks for your effort..your script runs smoothly

I post my script here as a backup.

#!/usr/bin/env bash
#title           : ubooquity.sh
#description     : Launch ubooquity server.
#date            : 20170807
#============================================================================== ### JAVA VARIABLES ###
# Java installation directory
# Maximum size of the Java runtime memory allocation pool. Default: 64MB
# Ubooquity binary location
# Ubooquity working directory
# Ubooquity process ID file location
# Ubooquity library port
# Ubooquity administration port
# Character encoding
# Locale selection
# Workaround to read special characters properly
export LANG # Kill previous process
if [ -f $PID_FILE ]; then
    pkill -F $PID_FILE > /dev/null 2>&1
fi # Launch ubooquity
printf "Starting Ubooquity server...\n" $JAVA_DIR/java -jar -Dfile.encoding=$ENCO -Xmx$MEM $UBOOQUITY_BIN \
               --adminport $ADMIN_PORT --libraryport $LIB_PORT \
               --workdir $WORK_DIR \
               --remoteadmin --headless & UBOOQUITY_PID=$! echo $UBOOQUITY_PID > $PID_FILE printf "Ubooquity is now running (pid: %d).\n" $UBOOQUITY_PID exit 0


I have a little issue in my DS415+, Ubooquity 1.10 run very good but when I want uptade to the version 2.0 or more Ubooquity stop running and refuses to start. I try the update methode or delete all the ubooquity files an make a new instalation but nothing work when I want instal 2.0 version.

I use GUI task to start Ubooquity like this :

/var/packages/Java8/target/j2sdk-image/bin/java -jar -Xmx1024m /var/packages/Ubooquity/Ubooquity.jar -workdir /var/packages/Ubooquity -port 2202 -headless -webadmin > nohup.out 2>&1&

Someone can help me for the conf file ? 

Can you help me please ^^ 

Best Regards 

Hello Raythefrenchy,

your call is with parameters in Ubooquity 1.x-Style, here's the updated call for Ubooquity 2.x : 

/var/packages/Java8/target/j2sdk-image/bin/java -jar -Xmx1024m /var/packages/Ubooquity/Ubooquity.jar -workdir /var/packages/Ubooquity -libraryport 2202 -headless -remoteadmin -adminport 2203 > nohup.out 2>&1&

Remind to rescan your entire collection after start Ubooquity 2.x - the 1.x database doesnt work anymore with 2.x ... 

Hope this helps 


Hello, as Raythefrenchy I can't update 1.10.1 to 2.1 on my NAS synology

Tom know this mistake but he don't know what we must do with synology.

It seems that you know a solution. 

But it is not yet very clear for me.

I have WinSCP and putty but I'm not a professional of code.

Usualy I have 2 solution for update. 

1) I replace ubooquity.jar with the new ubooquity.jar with winSCP

or 2) I use the line in putty : 

cd /var/packages && [ -d Ubooquity ] || mkdir Ubooquity && cd Ubooquity && wget -O ubooquity.zip http://vaemendis.net/ubooquity/service/download.php && 7z x ubooquity.zip && rm ubooquity.zip && cd /etc/init && wgethttps://vaemendis.github.io/ubooquity-doc/assets/files/install-synology/ubooquity.conf && chmod 755 ubooquity.conf

If I do that I can't acces to ubooquity, so I stay in 1.10.1

I have also 3 things in DSM in "task planification" for stop, or start ubooquity, or lunch ubooquity when NAS start.

So....Can you explain precisely how I should proceed to install Update 2.1 ?

The place of ubooquity is here : /var/packages/Ubooquity

My ebooks are here : /volume1/Mes-ebooks

My NAS is DS414   ,   DSM 6.1.3-15152 Update 3


I suppose I need to do :

not uninstal my ubooquity 1.10.1 ?

Stop ubooquity 

create task =>  just paste code in task planification in DSM ? what code ?

I need to download the new ubooquity.jar or not ?

Thank you for being precise because I am not an expert


Hello solspire,

because im current not able to work on any Synology NAS i can help you only basically, but i hope it helps you, too.

1. You need the current Ubooquity 2.x jar-file to use the 2.x Ubooquity - an auto-update isnt available. 

2. You need a Java-8-Runtime (here easy to get / install (thanks to rednoah) to run Ubooquity 2.x : 


3. Your Ubooquity.conf needs some manual edit,for using Ubooquity 2.x  the changes are here to find : 

exec /var/packages/JavaManager/target/Java/bin/java -jar -Xmx1024m /var/packages/Ubooquity/Ubooquity.jar -port 2202 -webadmin -workdir "/volume1/Comics/Ubooquity"


exec /usr/local/bin/java -jar -Xmx512m /var/packages/Ubooquity/Ubooquity.jar -libraryport 2202 -remoteadmin -adminpo

After all, you will need to re-scan your entire collection, because the 1.x database isnt working with Ubooquity 2.x .

In another ticket i heldep the user mroversi with the step-by-step manual for synology customised for a 2.x Ubooquity installation : http://ubooquity.userecho.com/topics/557-ubooquity-on-synology-ds-215j/

Perhaps this will help you too, but you have to check the path settings for your own installation 

(the workdir-parameter for you should be 

-workdir /volume1/Mes-ebooks

and the java-path 


works only if you have installed Java 8 with the java-installer-method from the above link to github.

hope this basically helps you


First a BIG THANK YOU for all your answers it works !!! 

I can upgrade to the version 2.1.0 ^^

You found the solution very quickly so I'm so so happy.

Thank you again and have a very nice evening.

An happy french guy 

-adminpo or -adminport



" -adminport 2203 "

there's a cut-off @ the end of the line, my mistake -b ig sorry  .... 

I try a new fresh installation on my synonogy NAS ds414 but ... is it hard for me....

Please, can you tell me if I am good ?

0) i uninstal java in package center of DSM

delete folder ubooquity in var/packages and

delete ubooquity.conf in etc/init (with WINSCP software)

So I am clean...

(I have my ebooks in "Mes-ebooks" share folder)

1) Java installation on my NAS synology 

two choices : a) java 8 package b) see picture under = I choose that

then I learn that https://vaemendis.github.io/ubooquity-doc/pages/tutorials/install-on-synology.html


2) connect as root and paste :

cd /var/packages 

[ -d Ubooquity ] || mkdir Ubooquity && cd Ubooquity

wget -O ubooquity.zip http://vaemendis.net/ubooquity/service/download.php

7z x ubooquity.zip && rm ubooquity.zip

exec /usr/local/bin/java -Dfile.encoding=UTF-8 -jar -Xmx1024m /var/packages/Ubooquity/Ubooquity.jar -libraryport 2202 -remoteadmin -adminport 2203

And after ?  I try localipnas:2202  but I have that :

ok, your fine, BUT : 

you looking @ an empty Database (localipnas:2202 is the library interface), try localipnas:2203 ;-) ... 

(localipnas:2203 is the ADMIN interface, an this interface should be self explained...) 

set up the necessary path information(s) for your cbr and/or epubs etc. click on "save & restart" and try again with localipnas:2202

hope this helps ! 


I have already try 2203 but no working too => I have that :

Other people have this ... https://www.google.fr/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjx5Y-Y96TWAhWmC8AKHfuGCeQQFggnMAA&url=https%3A%2F%2Fubooquity.userecho.com%2Ftopics%2F518-http-error-500-admin-page-in-202%2F&usg=AFQjCNFfPdp0VRI5_SZJn924dkWdcP4U5w

I will go to try with JAVA 8 package of synology for see is it better....

so the code is now :

exec /var/packages/Java8/target/j2sdk-image/bin/java -Dfile.encoding=UTF-8 -jar -Xmx1024m /var/packages/Ubooquity/Ubooquity.jar -libraryport 2202 -remoteadmin -adminport 2203

Just a thing 

How you exit after paste a code exec /var....... in putty  ?

Just close the putty windows ?! 

Always http error 500

maybe mistake in preferences.json ?

  "filesPaths" : [ ],
  "comicsPaths" : [ ],
  "booksPaths" : [ ],
  "users" : [ ],
  "isFilesProviderEnabled" : true,
  "isComicsProviderEnabled" : true,
  "isBooksProviderEnabled" : true,
  "isUserManagementEnabled" : false,
  "libraryPortNumber" : 2202,
  "adminPortNumber" : 2203,
  "comicWidth" : 160,
  "comicHeight" : 230,
  "comicsPaginationNumber" : 30,
  "bookWidth" : 160,
  "bookHeight" : 230,
  "booksPaginationNumber" : 30,
  "minimizeToTray" : false,
  "minimizeOnStartup" : false,
  "autoscanPeriod" : 0,
  "isRemoteAdminEnabled" : false,
  "theme" : "Default",
  "isShrinkingCacheEnabled" : false,
  "shrunkPageWidth" : 1536,
  "shrunkPageHeight" : 2500,
  "shrinkingCachePath" : "",
  "autoScanAtLaunch" : true,
  "reverseProxyPrefix" : "",
  "keystorePath" : "",
  "keystorePassword" : "",
  "isOpdsProviderEnabled" : false,
  "folderExclusionPattern" : "",
  "bypassSingleRootFolder" : false,
  "enableFolderMetadataDisplay" : false,
  "bookmarkUsingCookies" : false,
  "displayTitleInsteadOfFileName" : false,
  "keepUnreachableSharedFolders" : false

ok all work fine, I am a shit !

is it not locolipnas:2203 but  locolipnas:2203/admin !!!

I have all the @eadir files display ... Is it possible to hide that ?

It is. :)

Look at the "exclusion pattern" option in the advanced settings.

is it very very too slow .......30s/page


Unable to use

no display icon bookmark :( (with %reading)

or icon reading book for know where we must go to continu to read