问题
I am using JuiceSSH for making SSH connections to my RaspberryPi whenever I want. What I need to do is swap the IP address value into the JuiceSSH configuration file with the IP address that will be sent by RaspberryPi in case of IP address change. I am thinking about using a google apps script in which I can get the new IP address value from the e-mail. But I don't know where the JuiceSSH app holds the configurations. And I do not also know whether I can manipulate any file into an android phone using a google apps script.
回答1:
Google Apps Script cannot directly access any files except those in your Google Drive.
You may be able to empower a script to indirectly change the JuiseSSH config - if you can...
- Figure out where it is.
- Set up a web server on your phone to accept incoming POST operations.
- See this LifeHacker blog.
- When a valid POST is received, decode the payload and use it to update the local file.
- There will be security issues with this!
- Write your Google Apps Script
- Monitor your email for a message about a change in your Raspberry PI's IP address.
- Figure out how to track the phone's IP address!
- POST the update to your phone.
- retry periodically until the POST is successful (since the phone's connection is not reliable)
Another approach would be to have a Google Apps Script WebService serve up the current address of the device; then a program on the phone could periodically reach out to the service to find out the address, and update the file.
Of course, if you connected to your Raspberry PI using a name instead of an IP address, you wouldn't have to worry about any of this.
来源:https://stackoverflow.com/questions/24704943/is-it-possible-to-create-a-google-apps-script-that-manipulates-a-file-in-android