[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] Question about scripting...



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.

#!/bin/bash

workdir=/tmp
file="`hostname`.`date +%m%d%Y`.tgz"

# Functions

scpjvm () {

#!/usr/bin/perl -w

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'");


}

# 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

-- 
----------------------------------------
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