Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax Error #20

Closed
rea0056 opened this issue Mar 28, 2018 · 14 comments
Closed

Syntax Error #20

rea0056 opened this issue Mar 28, 2018 · 14 comments

Comments

@rea0056
Copy link

rea0056 commented Mar 28, 2018

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

@stevejenkins
Copy link
Owner

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!

@rea0056
Copy link
Author

rea0056 commented Mar 29, 2018

Hi Steve,

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

Thanks,
Faiz

@rea0056
Copy link
Author

rea0056 commented Mar 29, 2018

1
2

You can refer this picture.

Thanks,
Faiz

@stevejenkins
Copy link
Owner

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
Copy link

rjt commented Mar 29, 2018 via email

@rea0056
Copy link
Author

rea0056 commented Mar 29, 2018

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

@stevejenkins
Copy link
Owner

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. :)

@stevejenkins
Copy link
Owner

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

@rea0056
Copy link
Author

rea0056 commented Mar 29, 2018

Hi Steve,

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

1

Thanks
Faiz

@stevejenkins
Copy link
Owner

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.

@rea0056
Copy link
Author

rea0056 commented Mar 29, 2018

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

@stevejenkins
Copy link
Owner

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
Copy link

rjt commented Mar 29, 2018 via email

@rjt
Copy link

rjt commented Mar 29, 2018 via email

@rea0056 rea0056 closed this as completed Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants