stevejenkins/unifi-linux-utils

Syntax Error

Closed this issue · 14 comments

I got log "./uap_reboot.sh: 20: ./uap_reboot.sh: Syntax error: "(" unexpected"

I just copy all your script and just change the IP address in the ( ) and I got error "./uap_reboot.sh: 20: ./uap_reboot.sh: Syntax error: "(" unexpected".

I using Ubuntu 16.04.3

Thanks
Faiz

Hi, @rea0056. Is this the same issue as #15? If so, the latest version of the script (without quotes in the UAP list) will fix it on Ubuntu and I can close this issue. Thanks!

Hi Steve,

I already try without quote but the same message occur "./uap_reboot.sh: Syntax error: "(" unexpected"

Thanks,
Faiz

1
2

You can refer this picture.

Thanks,
Faiz

Very helpful screen caps. Thanks!

Will you please try changing the first line from #!/bin/sh to #!/bin/bash and tell me what happens?

rjt commented

Hi Steve,

Now the script can be execute by changing #!/bin/sh to #!/bin/bash . But now there was other issue occur.

1

Why permission denied? Is there something I missing?

Thanks,
Faiz

Are you able to SSH to those IP addresses manually using the same credentials you put in the script? And BTW, if that's your UniFi password shown in the screencap, you should probably change it. :)

@rea0056, @rjt makes an excellent suggestion. Please temporarily add -x to the first line: #!/bin/bash -x to run Bash in debug mode.

Hi Steve,

I able to SSH into the AP manually, but the script can't. Anything that I missing?

1

Thanks
Faiz

Please try:

sshpass -p PASSWORD ssh -oStrictHostKeyChecking=no -oUserKnownHostsFile=/dev/null USERNAME@IPADDRESS reboot

with your own PASSWORD, USERNAME, and IPADDRESS of a UAP, then let me know what happens.

Hi Steve,

I get the same message
"Warning: Permanently added '172.16.3.102' (RSA) to the list of known hosts.
Permission denied, please try again."

Thanks
Faiz

Ok, so either sshpass or the ssh client are generating that error.

Please try one of the two approaches in the answer here and see if that fixes:

https://askubuntu.com/questions/986179/permission-denied-when-trying-to-run-a-script-that-uses-sshpass

rjt commented
rjt commented