Les Mikesell wrote at about 09:37:47 -0500 on Monday, September 16, 2013:
> On Mon, Sep 16, 2013 at 8:52 AM, Dennis Ditte <dennis AT double-d DOT it>
> wrote:
> > Hi,
> >
> > i need to execute two commands in the PreUserCmd/PostUserCmd. I tried it
> > with this one:
> > $Conf{DumpPreUserCmd} = 'touch /var/lock/backuppc/BackupPC && $sshPath
> > -q -x -l root $host touch /var/lock/backuppc/BackupPC';
> > and this one:
> > $Conf{DumpPreUserCmd} = 'touch /var/lock/backuppc/BackupPC';
> > $Conf{DumpPreUserCmd} = ' $sshPath -q -x -l root $host touch
> > /var/lock/backuppc/BackupPC';
> >
> > At the first try, i can see in the logs that the Option -q is not valid
> > FOR "touch". If i try the command as backuppc-user in the shell it works.
> > The second try is also not working because only the last Line is executed.
> >
> > Is there a nice and easy way to do this?
>
> Backuppc doesn't execute a shell to parse the commands before starting
> them, so shell directives like && or ; aren't processed. The easiest
> way would be to put the commands you want to run in a shell script
> file and execute the script from backuppc.
>
If the (implied) script is simple as per the OP's desire to run just
two shell commands, it would be easier to use 'bash -c'
I think the following would work...
$Conf{DumpPreUserCmd} = 'bash -c "touch /var/lock/backuppc/BackupPC;
$sshPath -q -x -l root $host touch
/var/lock/backuppc/BackupPC"';
I haven't tested that but I don't see why it wouldn't work...
------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13.
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List: https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki: http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
|