C 40 scripting / startup scripts stuck in TSH

Answered Question
Apr 19th, 2012

Hello there,

I am having an issue when configuring a startup script on my C40.

I place the following code (as a test) in a tata.tsh file :

#!/usr/bin/env tsh

xcommand Message Alert Display Text: "hello"

bye

I gave the correct chmod value :

-rwxr-xr-x 1 root root 294 Apr 19 15:45 tata.tsh

But when I run the script it stays stuckin the TSH and do not excute the xcommand :

[C40-Lyon:/user/scripts.d] $ ./tata.tsh

Welcome to C40-Lyon

TANDBERG Codec Release TC5.1.0.280662

SW Release Date: 2012-02-14

OK

Only way to exist is to type bye or crtl +Z

Anyone has experienced the same issue ?

I have double sheck that EOL are Unix ones, and filetransfer set to text file.

Many thanks for your help !

PS : i'm using TC5.1.0.280662

added the version running on the C40

I have this problem too.
0 votes
Correct Answer by teckchye about 1 year 11 months ago

Hi,

If you have already created your script file in the user/scripts.d directory, and for example your file name is tata.tsh

Then, login as root and try this :

[C40-Lyon:/user/scripts.d] $ tsh

  • 1
  • 2
  • 3
  • 4
  • 5
Average Rating: 5 (1 ratings)
FlorianBerthelot Thu, 04/19/2012 - 09:09

Same issue when i Type :

[C40-Lyon:/user/scripts.d] $ tsh xcommand Message Alert Display Text: "hello"

Welcome to C40-Lyon

TANDBERG Codec Release TC5.1.0.280662

SW Release Date: 2012-02-14

OK

or

tsh tata.tsh

Magnus Ohm Thu, 04/19/2012 - 09:26

Hi florian

Tsh is the command to enter the api. I use this API all the time and its not an issue. Just type "bye" and it will exit. Try to type xcommand ? inside the api instead.

For the scripting part i use teraterm to feed commands step by step once in the api.

There is many ways of doing this but i'm not sure about the way you are doing it. Unfortunately im not near an endpoint to test this:/

/magnus

Sent from Cisco Technical Support iPhone App

FlorianBerthelot Thu, 04/19/2012 - 09:37

Hi,

thnaks for your quick reply.

I did follow the procedure described on the documentation :

http://www.cisco.com/en/US/docs/telepresence/endpoint/codec-c-series/tc5/api_reference_guide/codec_c60-c40_api_reference_guide_tc51.pdf) that says on page 171 :

Adding a startup script

The startup script can be used to execute certain commands

from the API during boot up. To enable this feature one must

log in to the codec as root and follow the below points.

Login to the codec

1.  Connect to the codec through the network, using a

command line interface (ssh, telnet or scp) and login as

root

2.  Make a user directory using the following command:

“mkdir /user/scripts.d”

3.  Put an executable file (permission must be changed to

executable) in this directory.

Example of the text in such a file:

The startup script file

•     The file must start with the following sequence:

#!/usr/bin/env tsh

•     The file can contain any xCommand or xConfiguration

command

•     The system will execute the commands/configurations in

sequence.

•     The file can have any name as long as it is placed in this

directory.

•     For multiple commands you must use Unix end of line

(LF). Windows end of line will not work.

#!/usr/bin/env tsh

xCommand Audio LocalInput Update InputId: 1 MixerMode:Fixed

If anyon has an idea thanks for sharing

Correct Answer
teckchye Thu, 04/19/2012 - 19:50

Hi,

If you have already created your script file in the user/scripts.d directory, and for example your file name is tata.tsh

Then, login as root and try this :

[C40-Lyon:/user/scripts.d] $ tsh

FlorianBerthelot Fri, 04/20/2012 - 06:39

Hello,

thanks for the tip, that went fine ! so basically what we do is redictecting the content of text file to the tsh command.

However, i still have a error message (pos1 is the file where xcommand is placed) :

[C40-Lyon:/user/scripts.d/pos] $ tsh

OK

*r PositionActivateFromPresetResult (status=OK):

** end

OK

Failed to read: Inappropriate ioctl for device

This is only cosmetic, but still weird I get this error...

Best regards

teckchye Fri, 04/20/2012 - 06:42

Hi,

Yes, when I try it, I got the same error prompt.  But the command does work, right?

Will try to find out why, and if I got any answer, I will update here.

FlorianBerthelot Fri, 04/20/2012 - 07:12

Yes, works perfectly !!

Many thanks to all of you for your help !

However :

Documentation says to create a file containing #!/bin/env tsh and commands following, ant hen execute file : this is actually not working this way

Hope this post will help others

Best regards

Magnus Ohm Thu, 04/19/2012 - 09:41

Are you sure the script did not work as it finished with "OK" inside. What if you add the "bye"command in the end of the script?

Magnus

Sent from Cisco Technical Support iPhone App

dderidde Sun, 04/22/2012 - 12:35

I think the user scripts have changed in later releases. You no longer need the line :

#!/usr/bin/env tsh

I tried this :

[dderidde-ex90-office:/user/scripts.d] $ pwd

/user/scripts.d

[dderidde-ex90-office:/user/scripts.d] $ cat test.tsh

xconfiguration Video Selfview :on

bye

[dderidde-ex90-office:/user/scripts.d] $

And you test the script using the command runuserscript :

[dderidde-ex90-office:/user/scripts.d] $ runuserscript ./test.tsh

Running user script: /user/scripts.d/test.tsh

Welcome to dderidde.ex90.office

TANDBERG Codec Release TC5.1.0.280662

SW Release Date: 2012-02-14

OK

** end

OK

[dderidde-ex90-office:/user/scripts.d] $

It will also get correctly started at bootup by /etc/init.d/S90userscript.

Actions

Login or Register to take actions

This Discussion

Posted April 19, 2012 at 8:09 AM
Stats:
Replies:9 Avg. Rating:5
Views:1000 Votes:0
Shares:0

Related Content

Discussions Leaderboard