Gave up on MIT's App Inventor. and switch to an android program called, "Tasker" https://play.google.com/store/apps/deta ... kerm&hl=en
Use steps below with ConnectBot and Tasker to send terminal commands with one click.
Tasker + ConnectBot can be used to execute arbitrary remote (or local, I guess, but Locale Execute is better for that) commands on a schedule.
Step 1: Setup terminal connection to send commands with ConnectBot .https://www.youtube.com/watch?v=3mPNL3dBsns
- a) Initial setup involves simply typing in the username followed by @ and hostname.
Example: email@example.com or firstname.lastname@example.org
b) The default port is 22. If you need to use a different port add a colon and the port number to the line above.
Example: email@example.com:222 or firstname.lastname@example.org:222
The IP address is, of course, the IP outside your firewall.
c) Long Press for the new entry in ConnectBot and you’ll see “edit host”. Select this if you want to change any of the info above.
Step 2: Public Key Generation in ConnectBot: http://www.youtube.com/watch?v=i0wBmC-5Vu0
or http://michaelchelen.net/0f3e/android-c ... uth-howto/
- a) Open ConnectBot
b) Click “Manage pubkeys”.
c) Click the Menu button on the phone.
d) Click “Generate”.
e) Now you have the options for key generation. For this particular purpose, I created a standard DSA key without password. I checked the “Load key on start” option. For improved security, a key size of 2048 or 4096 is now recommended. This does not affect any other steps.
f) You will help out with the key generation by sliding your finger across the box thats presented. Generating the key takes some time, and I guess that using a slower phone will extend the generating time. The new key has been created. It is unlocked and will be used by ConnectBot automatically when connecting to a server.
g) Copy public key you generated(long press on screen, copy public key in ConnectBot)
h) ssh from the phone using ConnectBot type the password.
i) type the line below in the terminal Press and hold to paste your new key. you should see it on the screen. Now type
then hit enter. This echoed your key into the authorized_keys file.
Code: Select all
Note you may need to create the folder (.ssh) and files (authorized_keys) use command below.
j) relog-in with ConnectBot note you now don't need a password
Code: Select all
cd /home/$USER/; mkdir .ssh ; cd .ssh;vi authorized_keys;chmod 644 .ssh/authorized_keys
Step 3: Set up your connection in ConnectBot to pass commands.
- a) Long Press and select "Edit Host"
b) click "Post-login automation" to add the remote commands you would like to run.
Note: Make sure there is a blank line at the end so that enter is sent after your last command. Use enter or ; to separate commands. I suggest using something like "echo hello" as a test until you are sure things are working, and "exit" at the end if you don't want to leave the connection open.
c) click, "OK" to save
d) Test if command works.
Note you can have duplicate connections in ConnectBot as long as they have different aliases "Nickname". You have to rename one first (away from user@host) in order to create the second.
Step 4: Create a Tasker Task to call connectbot.
- a) Open Tasker
b) Create a new Task in Tasker.
c) Add an Action. From Misc, select "Action Intent"
The fields are:
Data: ssh url, in the form of "ssh://user@host/#alias" (without the quotes). The alias, user and host here must match the alias you set up in Step 3 above.
Click Test. Connectbot should open and your commands should execute on the remote host.
Some Info from:
http://android.stackexchange.com/questi ... 16344_1459