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

TwonkyMedia, PS3, XBOX360, iTunes, & other media players

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

Postby crystalball » Tue Oct 02, 2012 1:25 am

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.
crystalball
Starting out
 
Posts: 39
Joined: Tue Sep 25, 2012 8:04 am
NAS Model: NMP-1000P

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

Postby Briain » Tue Oct 02, 2012 2:30 am

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
User avatar
Briain
Experience counts
 
Posts: 1118
Joined: Tue Apr 20, 2010 11:56 pm
Location: Edinburgh (Scotland)
NAS Model: TS-659 Pro

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

Postby crystalball » Tue Oct 02, 2012 3:15 am

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.
crystalball
Starting out
 
Posts: 39
Joined: Tue Sep 25, 2012 8:04 am
NAS Model: NMP-1000P

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

Postby crystalball » Tue Oct 02, 2012 5:02 am

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.
crystalball
Starting out
 
Posts: 39
Joined: Tue Sep 25, 2012 8:04 am
NAS Model: NMP-1000P

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

Postby Briain » Tue Oct 02, 2012 5:33 am

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
User avatar
Briain
Experience counts
 
Posts: 1118
Joined: Tue Apr 20, 2010 11:56 pm
Location: Edinburgh (Scotland)
NAS Model: TS-659 Pro

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

Postby crystalball » Tue Oct 02, 2012 5:56 am

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.
crystalball
Starting out
 
Posts: 39
Joined: Tue Sep 25, 2012 8:04 am
NAS Model: NMP-1000P

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

Postby schumaku » Tue Oct 02, 2012 2:53 pm

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.
User avatar
schumaku
Guru
 
Posts: 28324
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
NAS Model: TS-x79 Pro

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

Postby schumaku » Tue Oct 02, 2012 2:57 pm

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:
User avatar
schumaku
Guru
 
Posts: 28324
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
NAS Model: TS-x79 Pro

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

Postby crystalball » Tue Oct 02, 2012 4:42 pm

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.
crystalball
Starting out
 
Posts: 39
Joined: Tue Sep 25, 2012 8:04 am
NAS Model: NMP-1000P

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

Postby schumaku » Tue Oct 02, 2012 4:56 pm

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)
User avatar
schumaku
Guru
 
Posts: 28324
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
NAS Model: TS-x79 Pro

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

Postby crystalball » Tue Oct 02, 2012 5:17 pm

So there is no chance to start twonky with a bash script?
crystalball
Starting out
 
Posts: 39
Joined: Tue Sep 25, 2012 8:04 am
NAS Model: NMP-1000P

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

Postby schumaku » Tue Oct 02, 2012 6:59 pm

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.
User avatar
schumaku
Guru
 
Posts: 28324
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
NAS Model: TS-x79 Pro

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

Postby crystalball » Tue Oct 02, 2012 7:25 pm

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"
crystalball
Starting out
 
Posts: 39
Joined: Tue Sep 25, 2012 8:04 am
NAS Model: NMP-1000P

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

Postby schumaku » Tue Oct 02, 2012 7:36 pm

If you would be so nice and read the replies ie. that one viewtopic.php?f=177&t=64713#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.
User avatar
schumaku
Guru
 
Posts: 28324
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
NAS Model: TS-x79 Pro

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

Postby crystalball » Tue Oct 02, 2012 8:10 pm

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
crystalball
Starting out
 
Posts: 39
Joined: Tue Sep 25, 2012 8:04 am
NAS Model: NMP-1000P

Next

Return to Media Streaming

Who is online

Users browsing this forum: No registered users and 24 guests