On Mon, Aug 10, 2009 at 9:46 AM, Michal Hrusecky
Chuck Payne - 8:27 10.08.09 wrote:
Sorry if this question seem a bit silly, but I am still very much a newbie when it come some to scripting.
I want to write a shell script that does some scp of files, but I like to use both bash and perl. Could I do some thing this, how would I got about mixing shell, python, perl and other things with in a script.
I would prefer writing it all in shell, but what about something like this:
-------------------------------------------------------------------------- #!/bin/bash
workdir=/tmp file="`hostname`.`date +%m%d%Y`.tgz"
# Functions
scpjvm () {
perl -w << EOF
use Net::SFTP; use strict;
my \$host = "mars.myhost.com"; my %args = ( user => 'toor, password => '1234567', debug => 'true' );
my \$sftp = Net::SFTP->new(\$host, %args); \$sftp->get("/tmp/'jvm.`hostname`.`date +%m%d%Y`.tgz'", "/home/ia/'jvm.`hostname`.`date +%m%d%Y`.tgz'");
EOF
# The work
cd $workdir
tar czvfpP $file /etc/httpd /opt/jboss/jboss/bin/ /opt/jboss/jboss/server /usr/local/bin --exclude *log* --exclude *nohup*
scpjvm
rm $file
--------------------------------------------------------------------------
-- Michal Hrusecky
Package Maintainer SUSE LINUX, s.r.o e-mail: mhrusecky@suse.cz
Thanks Michal, I will give that a try and I am currently reading the link that Greg gave me too. Again guys, thanks. I know it was a silly question, but at this time, I don't do much with perl. I am trying to learn Python. So thanks guys. -- ---------------------------------------- Old utilities do not die they just slowly fade away! ----------------------------------------- OpenSUSE -- http://en.opensuse.org/User:Terrorpup OpenSuSE Ambassador OpenSuSE Member Skype -- terrorpup twitter -- terrorpup -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org