ssh username@foo.bar.com

add foo.bar.com into host file

opkg update
opkg install empty
nano /mnt/sda1/autossh.sh
#!/bin/sh
empty -f -i in -o out ssh username@foo.bar.com
#empty -w -i out -o in "ogin:" "root\n"
empty -w -i out -o in "assword:" "TopSecret\n"
#empty -s -o in "who am i\n"
empty -s -o in "touch newfile\n"
empty -s -o in "exit\n"
chmod 755 /mnt/sda1/autossh.sh
/mnt/sda1/autossh.sh

ssh into server foo.bar.com make sure at home directory of username, the file name of newfile is created.

 

http://empty.sourceforge.net/

Comments powered by CComment