Page 1 of 2

How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 1:25 am
by crystalball
Is it possible to stop / start twonky in a bash script correctly?
ls -l /etc/init.d/twonky*
-rwxr-xr-x 1 admin administ 10112 Apr 20 14:02 /etc/init.d/twonkymedia.sh*
lrwxrwxrwx 1 admin administ 49 Sep 30 22:56 /etc/init.d/twonkymedia6.sh -> /share/HDA_DATA/.qpkg/TwonkyMedia/twonkymedia6.sh*
How must that be done with Twonky 6 and 7?

I noticed, when I change about 1000 playlists, but no mp3, the script which changes the playlists lasts 4 min. if the service is down, but 14 min. if the service is running. But I have no idea, if the scan takes longer at the end, when I stopped the service before.

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 2:30 am
by Briain
Hi

/etc/init.d/twonkymedia6.sh stop
/etc/init.d/twonkymedia6.sh start

I think you can also use the ...sh restart (which effectively runs both the above).

Bri

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 3:15 am
by crystalball
Thanks, so it is done as with Linux "normally". Some other NAS-brands do it in a different way and I had big troubles with these other brands, so I changed to Qnap ;-) but I don't want to do something wrong again.

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 5:02 am
by crystalball
Unfortunately

Code: Select all

/etc/init.d/twonkymedia6.sh start
leads to problems, it does _not_ start the service again, maybe because of
PID file /tmp/mediaserver.pid not found, stopping server anyway...
So start stops the service. The webinterface says that the service is running, after stopping the service with the webinterface it can be started again with the webinterface.

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 5:33 am
by Briain
I thought it worked in Twonky 6, but I've not tried Twonky 7, so I'll look tomorrow. I think the web interface possibly controls it via rpc calls:

http://NAS.ip.add:9000/rpc/stop
http://NAS.ip.add:9000/rpc/start
http://NAS.ip.add:9000/rpc/restart

These can be used with the actual NAS IP address, or the local loopback address.

Bri

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 5:56 am
by crystalball
I am using Twonky 6.0.39 (at the moment) with the QNAP-version, so I have the problems with Twonky 6.

So you mean I have to use wget instead of /ete/init.d with a bash-script? I would like to create stops and starts within a script.

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 2:53 pm
by schumaku
Vaguely remember: Double check if your Twonky 6 is the firmware built-in Twonky or the QPKG-installed version. hese might use a different scriot - without resp. with the 6.

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 2:57 pm
by schumaku
Briain wrote:I thought it worked in Twonky 6, but I've not tried Twonky 7, so I'll look tomorrow. I think the web interface possibly controls it via rpc call.
stop and restart appear to work ... start might be difficult with no service listening on port 9000 :lol:

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 4:42 pm
by crystalball
What can I do?
80/tcp open http?
443/tcp open ssl/https?
|_sslv2: server still supports SSLv2
631/tcp open ipp CUPS 1.4
873/tcp open rsync (protocol version 30)
3493/tcp open tcpwrapped
8080/tcp open http-proxy?
8090/tcp open ssl/unknown
|_sslv2: server still supports SSLv2
9000/tcp open cslistener?
49152/tcp open upnp Portable SDK for UPnP devices 1.4.1 (kernel 2.6.33.2; UPnP 1.0)
4 services unrecognized despite returning data.

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 4:56 pm
by schumaku
crystalball wrote:What can I do?
About what? I just pointed out that
1. different scripts are used for firmware built-in Twonky 6 vs. QPKG Twony 6 most likley, and
2. the RPC can only work if there is a deamon - once stopped, there is no listender, so no Twonky RPC calls possible obviously to start. (edit: ...and we're talking of Twonky Web server based RPC commands here, nothing else)

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 5:17 pm
by crystalball
So there is no chance to start twonky with a bash script?

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 6:59 pm
by schumaku
Of course you can stop it - by calling the _correct_ script... why not?
Please - at least for yourself - answer the question I raised sosme posts back... QPKG of firmwae built-in. I?m convinced, you are using the wrong script - there is nothing else on the NAS to start/stop the DLNA server.

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 7:25 pm
by crystalball
schumaku wrote:Vaguely remember: Double check if your Twonky 6 is the firmware built-in Twonky or the QPKG-installed version. hese might use a different scriot - without resp. with the 6.
How can I check this?
The webinterface says for Version 7, which i simply downloaded via the webinterface: Version: TwonkyServer Premium 7.0.9

I can _stop_ twonky, no problem, but I cannot _start_ it again.

Edit: I switched to Version 7. Going back to Version 6, means a scan for hours. But it is the same with Twonky 7:

Code: Select all

# /etc/init.d/twonkymedia.sh stop   
Shutting down UPnP MediaServer services: twonkymedia.kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

Code: Select all

# /etc/init.d/twonkymedia.sh start
UPnP MediaServer is disabled. If the process still existed, try to run "/etc/init.d/twonkymedia.sh stop"

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 7:36 pm
by schumaku
If you would be so nice and read the replies ie. that one http://forum.qnap.com/viewtopic.php?f=1 ... 13#p290532 ...would lead to the following solution:

[~] # ps -ef | grep onky
1570 admin 360 S /share/MD0_DATA/.qpkg/TwonkyMedia/twonkystarter -inif
1571 admin 62856 S /share/MD0_DATA/.qpkg/TwonkyMedia/twonkyserver -inifi
4584 admin 292 S grep onky
[~] # /etc/init.d/twonkymedia6.sh stop
Shutting down UPnP MediaServer services: twonkymedia.
[~] # ps -ef | grep onky
4635 admin 288 S grep onky
[~] # /etc/init.d/twonkymedia6.sh start
Starting UPnP MediaServer: (/share/MD0_DATA/.qpkg/TwonkyMedia/twonkystarter)
[~] # ps -ef | grep onky
4679 admin 360 S /share/MD0_DATA/.qpkg/TwonkyMedia/twonkystarter -inif
4680 admin 17320 S /share/MD0_DATA/.qpkg/TwonkyMedia/twonkyserver -inifi
5004 admin 288 S grep onky

I can ... find the difference please.

This script -_does_ work with both QPKG installed Twonky 6 and Twonky 7.

Doing anything different can and will lead to unexpected results.

Re: How to stop/start Twonky 6 / 7 in a bash-script

Posted: Tue Oct 02, 2012 8:10 pm
by crystalball

Code: Select all

[~] # ps -ef | grep onky
16622 admin       412 S   /share/HDA_DATA/.qpkg/TwonkyMedia/twonkystarter -inifile /etc/config/twonkyvision-mediaserver6.ini 
16623 admin     87620 S   /share/HDA_DATA/.qpkg/TwonkyMedia/twonkyserver -inifile /etc/config/twonkyvision-mediaserver6.ini -
18342 admin       568 S   grep onky 
[~] # 
[~] # /etc/init.d/twonkymedia
twonkymedia.sh   twonkymedia6.sh  
[~] # /etc/init.d/twonkymedia.sh stop
Shutting down UPnP MediaServer services: twonkymedia.kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]

[~] # ps -ef | grep onky
18771 admin       568 R   grep onky 
[~] # 
[~] # /etc/init.d/twonkymedia.sh start
UPnP MediaServer is disabled. If the process still existed, try to run "/etc/init.d/twonkymedia.sh stop"
[~] # 
[~] # ps -ef | grep onky
18785 admin       568 R   grep onky