On Tue, Sep 17, 2013 at 6:38 AM, Dennis Ditte <dennis AT double-d DOT it> wrote:
>
>
> 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...
>
>
> I tested it and it don't work. I think the " " are a problem. I tried to
> escape them with \ but it doesn't work:
>
> Executing DumpPostUserCmd: bash -c "rm -rf
> /var/lock/backuppc/backuppc-10.1.1.10; /usr/bin/ssh -q -x -l root 10.1.1.10
> rm -rf /var/lock/backuppc/backuppc-10.1.1.10"
> -rf: -c: Zeile 0: End of file 'is reached when searching for `".
> -rf: -c: Zeile 1: syntax error: unexpected end of file..
>
> Executing DumpPostUserCmd: bash -c \"rm -rf
> /var/lock/backuppc/backuppc-10.1.1.10; /usr/bin/ssh -q -x -l root 10.1.1.10
> rm -rf /var/lock/backuppc/backuppc-10.1.1.10\"
> -rf: "rm: Command not found.
>
> Any ideas?
Backuppc is going to run the command with exec(), not system() so I
don't think passing a double-quoted string is going to work even if
you execute your own shell to parse it. Is there some problem with
putting the commands in a shell script file and making that your
command?
--
Les Mikesell
lesmikesell AT gmail DOT com
------------------------------------------------------------------------------
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/
|