tcmd command line tool - error
-
Hi, I have followed the instructions here: https://www.triggercmd.com/forum/topic/196/tcmd-go-command-line-tool-is-available-now to use the tcmd command line tool on a RPi.
I have created a token.tkn file in ~/.TRIGGERcmdData and put my token in it.
When I type ./tcmd -t shutdown to trigger shutdown of my remote PC (this works from Windows fine btw), I get this:
pi@rpi-smarthome:~/triggercmd $ ./tcmd -t shutdown panic: parse https://www.triggercmd.com/api/run/triggersave?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlODNmNmFhN2M4MDJhMDAxOWUxMzExNyIsImlhdCI6ABCDEFGHIJ0MH0.XtsNVVWeh7HKymsT31ufea9T8HCScsu9g5r1vqSwXZE &trigger=shutdown: net/url: invalid control character in URL goroutine 1 [running]: main.main.func1(0x1c9c2c0, 0x0, 0x0) D:/appdev/triggercmd/triggercmdGOclient/tcmd.go:141 +0xc24 github.com/urfave/cli.HandleAction(0x342048, 0x1c0ad60, 0x1c9c2c0, 0x1c9c2c0, 0x0) C:/Users/russe/go/pkg/mod/github.com/urfave/cli@v1.22.2/app.go:523 +0xac github.com/urfave/cli.(*App).Run(0x1c00fc0, 0x1c0a140, 0x3, 0x4, 0x0, 0x0) C:/Users/russe/go/pkg/mod/github.com/urfave/cli@v1.22.2/app.go:285 +0x430 main.main() D:/appdev/triggercmd/triggercmdGOclient/tcmd.go:167 +0x3b8
(If I copy and paste the URL in the error message into Chrome, it triggers the shutdown just fine.)
What am I doing wrong? Thanks!
-
This post is deleted! -
OK - I solved my issue. I was using nano file editor to create token.tkn file. I would then paste the token into the first line and save using CTRL-O. It failed with the above error.
I tried creating the file with cat > token.tkn and pasting the token followed by CTRL-D.
It now works fine. So nano must be putting some invalid character at the end of the pasted token string that 'tcmd' can't deal with. Maybe 'tcmd' could be updated to check for this?
Thanks!