news

Update NodeJS on Qnap and fix insufficient space issue

Rss feed for topic ArticleArticle - Posted by: christian On 07-01-2016 @ 00:12 - Updated on: 07-01-2016 @ 00:12

This week I needed Nodejs and NPM on my qnap to run Nefit easy http server to have an bridge between my nefit easy thermostate and my fibaro home center 2(Maybe I will write an article on this later). Fairly quickly I found out the nodejs version that can be installed from the qnap app center is old and not sufficient to run the applications. So I tried to update it to the newest version and fix the problem where my ramdisk was out of space when I tried to install any npm package.

To start install the nodejs package from the app center(the nodejs version isn't needed but this is much easier as you don't need to create any startup script or whatever since you can just use the default one).

Update to newest version

After this, login to your nas through SSH(use putty for this for example). Go into your nodejs directory. For me it was located at "/share/MD0_DATA/.qpkg/nodejs". Rename the "node" directory to "node-old" with the following command: mv node node-old

Download the newest nodejs version to your nas using wget. This can be done with the following command:

wget https://nodejs.org/dist/v4.2.4/node-v4.2.4-linux-x86.tar.gz

The newest version can be found here you need the "Linux binaries" 32 bit version

Run to extract: tar zxf ./node-v4.3.4-linux-x86.tar.gz
Rename the directory: mv node-v4.3.4-linux-x86 node

After this you can just update with: npm install npm -g

Fix insufficient space issue on qnap ramdisk when installing a npm package

The problem is, the default location of the npm cache is in root(/root/.npm to be more preciselly) which is on the qnap ramdisk. This location is quite small, around 140mb on my NAS(on some other types even smaller). So we can simply fix this by changing the location of this directory to a path located on the harddrive instead of the ramdisk.

Just run the following command:

npm config set cache /share/MD0_DATA/.qpkg/nodejs/.npm --global

To check if the change has been applied correctly run: npm config list

Hint: incase you already have a qnap where the ramdisk is 100% in use because of this issue simply restar the qnap and the problem will be fixed.

print 'No article is available';


Missing On/Off Button Qnap QTS 4.1.1 Qpkg fix

Rss feed for topic ArticleArticle - Posted by: christian On 17-09-2014 @ 21:53 - Updated on: 17-09-2014 @ 21:54

After the release of Qnap Firmware 4.1.1 today some of my home made qpkgs stopped working and the On/Off enable button dissapeared from the App center in QTS.

After searching for a solution for hours I finally found out and the solution is really simple.

In /etc/config/qpkg.conf all qpkgs are declared.

One of the variable of a Package is "shell". When shell is typed with a lowercase "s" the on/off button doesn't show up in qts 4.1.1 anymore and the package doesn't start on boot. When changing shell to Shell(uppercase!) the button shows up again.

So a little example of the change:

Wrong(working prior 4.1.1):

[AutoSub]
Name = AutoSub
Enable = TRUE
Version = Newest
QPKG_File =
Date = 2012-12-09
shell = /share/MD0_DATA/.qpkg/auto-sub/AutoSub.sh
Install_Path = /share/MD0_DATA/.qpkg/auto-sub
WebUI = /
Author = Christian
Web_port = 8083
RC_Number = 133

Fixed(working on all firmwares including 4.1.1)

[AutoSub]
Name = AutoSub
Enable = TRUE
Version = Newest
QPKG_File =
Date = 2012-12-09
Shell = /share/MD0_DATA/.qpkg/auto-sub/AutoSub.sh
Install_Path = /share/MD0_DATA/.qpkg/auto-sub
WebUI = /
Author = Christian
Web_port = 8083
RC_Number = 133

 

It's really easy but took me 2 hours to find out this was the problem, maybe it will help someone else with the same problem.

print 'No article is available';


How to add default PHP 5.3 CLI to Qnap 4.0.3

Rss feed for topic ArticleArticle - Posted by: christian On 06-12-2013 @ 22:52 - Updated on: 07-12-2013 @ 00:20

On my Qnap the php CLI command for the default Qnap PHP 5.3 didn't work. I've been searching for a sollution for a while and finally found one.

For everyone who has the same problem on his qnap, just login to your qnap via SSH and execute the following command:

ln -s /mnt/ext/opt/apache/bin/php /opt/bin

This will simply create a symlink to the default php 5.3 in a directory on your path(it even survives a reboot of your qnap).

To see if it works:

[/share/] # php -v
PHP 5.3.26 (cli) (built: Sep 12 2013 05:30:14)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies

That's it! 

print 'No article is available';


Install Subliminal on Qnap to retrieve subtitles for your shows

Rss feed for topic ArticleArticle - Posted by: christian On 02-12-2013 @ 22:02 - Updated on: 03-12-2013 @ 21:02

I always used a fully automatic way to retrieve new subtitles for tv shows on my Qnap Nas. Since Bierdopje stopped last week and Auto Sub stopped working because of this I was searching for a new way to retrieve subtitles automatically. I found Subliminal. Since there is no qpkg for Qnap available I created my own bash script. The script will auto start subliminal on qnap startup and run it every few hours after this, it will also update subliminal automatically on every startup if needed. This all can be done from the Qnap app center.

The script will start Subliminal on startup and run Subliminal to search for Dutch and English subtitles every 2 hours.

To get Subliminal working on your Qnap Nas you should login to your NAS by SSH(for example you can use Putty for this).

Create a directory under: "/share/MD0_DATA/.qpkg" called "Subliminal" (without the quotes).

After this pull the Subliminal source by using git(the script uses Subliminal/subliminal as directory for this): "git clone https://github.com/Diaoul/subliminal.git"

You can install Subliminal yourself by running: "python setup.py install" from the subliminal directory.

If you get "error: /opt/local/lib/python2.5/site-packages (in --site-dirs) is not on sys.path" then you can fix this by using the following command: "export PYTHONPATH=/opt/local/lib/python2.5/site-packages". After this you have to run the subliminal install command again and no error should show up this time.

After this create the startup script in the Subliminal package root(/share/MD0_DATA/.qpkg/Subliminal)

#! /bin/sh
### BEGIN INIT INFO
# Provides: Subliminal application instance
# date: 02-12-2013
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts instance of Subliminal
# Description: starts instance of Subliminal using start-stop-daemon
### END INIT INFO
############### EDIT ME ##################
QPKG_NAME=Subliminal
QPKG_DIR=
DAEMON=/opt/bin/python2.7
DAEMON_OPTS="/share/MD0_DATA/.qpkg/Optware/local/bin/subliminal -l nl en -a 8w -c /share/MD0_DATA/.qpkg/Subliminal/subliminal.cache.dbm --log-file /share/MD0_DATA/Download/Subliminal_log.txt -v"
MOVIE_DIRECTORY="/share/MD0_DATA/TV Shows/"

add_cron(){
#adds the subtitle finderjob to the crontab
if [ x"$(/bin/cat /etc/config/crontab | /bin/grep "subliminal")" = x ]; then
/bin/echo "15 */2 * * * ${DAEMON} ${DAEMON_OPTS} \"${MOVIE_DIRECTORY}\"" >> /etc/config/crontab
fi
#restart crontab
/usr/bin/crontab /etc/config/crontab
}

remove_cron(){
#removes the update job from the crontab
if [ -n "$(/bin/cat /etc/config/crontab | /bin/grep "/subliminal")" ]; then
/bin/sed -i '/subliminal/d' /etc/config/crontab
fi
#restart crontab
/usr/bin/crontab /etc/config/crontab
}

update_subliminal(){
#update subliminal to last version from git
cd /share/MD0_DATA/.qpkg/Subliminal/subliminal
git fetch origin
reslog=$(git log HEAD..origin/master --oneline)
if [[ "${reslog}" != "" ]] ; then
echo "Updating Subliminal to newest version from Git!"
git pull
echo "Install new version"
export PYTHONPATH=/opt/local/lib/python2.5/site-packages
${DAEMON} setup.py install
else
echo "no update available"
fi
}


case "$1" in
start)
echo "Starting $QPKG_NAME"

if [ `/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f /etc/config/qpkg.conf` = UNKNOWN ]; then
/sbin/setcfg ${QPKG_NAME} Enable TRUE -f /etc/config/qpkg.conf
elif [ `/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f /etc/config/qpkg.conf` != TRUE ]; then
echo "${QPKG_NAME} is disabled."
exit 1
fi
#remove log file
rm /share/MD0_DATA/Download/Subliminal_log.txt

update_subliminal

/bin/echo "Running Subliminal now with the following arguments:"
/bin/echo ${DAEMON} ${DAEMON_OPTS} ${MOVIE_DIRECTORY}
${DAEMON} ${DAEMON_OPTS} "${MOVIE_DIRECTORY}"

/bin/echo "Add Subliminal to the crontab to run every few hours"
add_cron
;;

stop)
echo "Stopping $QPKG_NAME"
remove_cron
for pid in $(/bin/pidof python); do
/bin/grep -q "subliminal" /proc/$pid/cmdline && /bin/kill $pid
done
/bin/sleep 2
;;

restart|force-reload)
echo "Restarting $QPKG_NAME"
$0 stop
$0 start
;;

*)
N=/etc/init.d/$QPKG_NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0

 

The script can be downloaded here.

The arguments can be modified and the path to your tv show/movie directory must be changed. From default it's downloading dutch and english subtitles and only scans files from the last 8 weeks. Logging is enabled(see "/share/MD0_DATA/Download/Subliminal_log.txt")  and the log file is removed on every startup

To see Subliminal as a qpkg in the app center and make it start on qnap startup automatically you have to add a new qpkg to the qpkg.conf(can be found in "/etc/config/qpkg.conf").

I'm using the following code:

[Subliminal]
Name = Subliminal
Enable = FALSE
Version = Newest
QPKG_File =
Date = 2013-12-02
shell = /share/MD0_DATA/.qpkg/Subliminal/Subliminal.sh
Install_Path = /share/MD0_DATA/.qpkg/Subliminal
Author = Christian
RC_Number = 134

Now everything is ready and you can start Subliminal from the app center on your qnap. From now on you will always have the latest subtitles.

If you need support feel free to contact me trough email or leave a comment below

 Download: Subliminal.sh

print 'No article is available';


Start windows 8 media center automatically when windows starts

Rss feed for topic ArticleArticle - Posted by: christian On 10-11-2012 @ 18:07 - Updated on: 10-11-2012 @ 18:10

Since Windows 8 is out and the media center pack can be grabbed for free until january 2013. I installed it on my HTPC to give it a try. It's working very nice after a few tweaks.

Everything is the same except it's much faster and some small features have changed. Like starting windows media center when windows starts(the way it was in Windows 7). This feature is gone in Windows 8 media center. For a htpc this is big problem but after a few hours of searching for a solution I finally found one. So here it is:

  1. Install Skip metro suite(this will keep all windows 8 features like metro and doesn't add an old startbutton, it's just needed to boot windows 8 to desktop to start windows media center)
  2. Create a shortcut for windows media center(path: %windir%\ehome\ehshell.exe ).
  3. Put the created shortcut in the startup folder (path: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp (this path can be different for different languages in windows since my windows 8 version is in Dutch))
  4. Just reboot windows 8 and see windows media center booting right on startup

Skip metro suite is needed because without it windows media center will be started behind the metro screen.

print 'No article is available';


How To Change Windows 7 Offline Files Location?

Rss feed for topic ArticleArticle - Posted by: christian On 17-08-2011 @ 00:31 - Updated on: 17-08-2011 @ 00:34

I got a computer with all my music and a HTPC with a nice speaker system. But I want to be able to play all my music on my HTPC even when my computer is turned off. A nice feature to do this is by using windows offline files. This feature allows you to make a backup from a selected location that can be used if the network location is not available. When the network connection becomes available it will use the files on the computer and sync the local backup. This way I can always play my music even when the computer with the music collection is turned off.

This is a really nice feature of Windows 7, but one problem is. Out of the box it can only use your boot disk to make the backups to. This isn't a problem when you got a big disk. But since I added a 60gb SSD as boot disk last week this wasn't enough for my music collection(It's about 300gb).

Since there isn't a simple option to choose where the offline files should be stored I was searching for a solution. There are many topics about this problem on the internet. With various solutions, most of them are really complicated.

But I found a really easy solution to solve this problem by just adding a registry key with the new path.

Just create a new registry key under: HKLM\System\CurrentControlSet\Services\CSC\Parameters

The registry key should be called: CacheLocation
And the key type should be: REG_SZ

The new path should be in the NT extension, like \??\f:\csc (This will store the offline files in directory csc on the f disk)
 

 

print 'No article is available';


Next >>