Thursday, September 29, 2011

Re: (off-topic) Quick method of sending files from ssh to clients

This thread is already off topic - so thought I should +1 on pexpect. 

Anyone who hasn't tried it already - should defo take a look.

Used it in quite a few data scrapping Django projects (mostly for talking with devices on RS232 over TCP) - it's very nice.

Cal

2011/9/29 Charles Cossé <ccosse@gmail.com>
Hello, (this is my first post here), just thought it might be helpful to mention python's pexpect module.  It's used like this:

rcmd="ssh root@%s /etc/init.d/firewall restart"%(IP_SOMEWHERE)
foo = pexpect.spawn(rcmd)

-Charles Cosse


2011/9/29 Bjarni Rúnar Einarsson <bre@pagekite.net>
2011/9/29 Bjarni Rúnar Einarsson <bre@pagekite.net>:
> If you have mutt installed (a popular text-mode mail reader/writer),
> you can get the same thing done without any scripting:
>
> $ echo 'Here you go' |mutt recipient@domain.com -s 'My subject' -a /path/to/file

... following up to myself, one of the main benefits to this approach
is you can have multiple -a arguments to attach multiple files, and if
you run just 'mutt -a /path/to/file -a /path/to/file2', it will
interactively ask you to fill in the blanks.

Although a bit long in the tooth, I think mutt is probably still king
of the console mail clients. :-)

--
Bjarni R. Einarsson
Founder, lead developer of PageKite.

Make localhost servers visible to the world: http://pagekite.net/

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.




--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment