My last 2cents
You could get the job done or you could just brain storm about it.
When you are su to a different user you are creating a chilled process,
so your script has to have a way to communicate with a child process. In
the good old day there was a scripting language name "EXPECT" which
could pass the arguments to the chilled process. But I think you problem
is much simpler than that. Let's break it up in two sections.
Second section first.
2) tar and gzip files with a to privileged restricted location allowed.
There is a concept of "sticky bit" in UNIX you could create a script
that will run as a privileged user. But anybody could run that scrip.
#!/usr/bin/sh
# script to backup file as BIG DUDE
# scrip name = Backmeup.sh
tar cvf /BackupDirectory/Mydailybakup.tar /sorce/needto/bakup/*
gzip /BackupDirectory/Mydailybakup.tar
after saving this file you have to make this a sticky bit it
login as the priviladged user and > chmod 4755 Backmeup.sh
Now we are going to do the 1st part
1)
<sshexec host="Host we are going to run the script on"
username="you"
password="dude"
command="/where/thefileIs/Backmeup.sh"/>
Good luck
Best Regards
Afshin Bozorgzadeh
>Fidelity Investments Brokerage Company
>FBCT ClearCase Release Engineer
Afshin.Bozorgzadeh@fmr.com
Phone 603-791-5596
BlackBerry 603-365-0205
-----Original Message-----
From: Jakob Fix [mailto:jakob.fix@gmail.com]
Sent: Tuesday, November 22, 2005 10:56 AM
To: Ant Users List
Subject: Re: Backup before deploy
Keith,
On 22/11/05, keith wong <ckeiwong@yahoo.com> wrote:
> Hello,
> I need control remote host thru ssh to tar all backup
> file, but I get into problem of "su - " command after
> ant <sshexec> in. I not sure how to keep ssh session
> and process two steps command to archive. Here is
> steps I need to make:
> 1. SSH to remote.
> 2. su to our user.
not sure how to do this ant (haven't looked at the documentation), but
I would probably
ssh -l theRemoteUserName
to the remote site. Of course, it would be bad practice to ssh as root
...
HTH
> 3. tar all backup and save it to privielge
> restricted location allowed
> from that "su"ed user.
> 4. compress the tar to save space.
>
> Thank you for any input.
>
> Regards,
> Keith
>
>
>
--
cheers,
Jakob.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
|