Re: [Bacula-users] Running complex commands or scripts remotely on a client
On 6 September 2012 14:36, Gary R. Schmidt wrote: > As a suitably secure user: > > $ for i in `cat list_of_backup_machines` > do > scp magicscript $i:/opt/bacula/magicscript > done Yep, I know I can scp cycle on a list of machines, but doesn't fit anyway. We don't have SSH enabled for all segments of the lan and most important many of the boxes (70%) are Windows based on multiple domain (and childs) in 2 different forests. Having all the commands specified on the director is the most simple one. Regards, --Simone -- You cannot discover new oceans unless you have the courage to lose sight of the shore (R. W. Emerson). -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
Re: [Bacula-users] Running complex commands or scripts remotely on a client
On 6/09/2012 6:39 PM, Simone Caronni wrote: >> You could also use multiple ClientRunBefore statements in the config file. >> Personally I would still prefer a script in the client. > On my setups I use the opposite. If you need to add a line to the > script, you need to copy the same script over all the clients. With > multiple lines, maybe you can change just one line in the Job > Definition. > > Don't know how many you have in your backup infrastructure, but that's > not feasible at all in our setup; especially because the clients and > daemons are separated by firewalls and do not allow easy copying > everywhere. As a suitably secure user: $ for i in `cat list_of_backup_machines` do scp magicscript $i:/opt/bacula/magicscript done If you haven't set up ssh-equivalence, and, for some reason cannot do so, then an 'expect' script is only slightly more complicated. Probably be a good idea, in that case, to write an expect script to set up ssh equivalence. Cheers, GaryB-) -- When men talk to their friends, they insult each other. They don't really mean it. When women talk to their friends, they compliment each other. They don't mean it either. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
Re: [Bacula-users] Running complex commands or scripts remotely on a client
On 06/09/12 16:39, Simone Caronni wrote: >> You could also use multiple ClientRunBefore statements in the config file. >> Personally I would still prefer a script in the client. > On my setups I use the opposite. If you need to add a line to the > script, you need to copy the same script over all the clients. With > multiple lines, maybe you can change just one line in the Job > Definition. > > Don't know how many you have in your backup infrastructure, but that's > not feasible at all in our setup; especially because the clients and > daemons are separated by firewalls and do not allow easy copying > everywhere. Thank you everybody for your answers, I now use ";" to separate shell commands on one line and if I reach the limit then add more ClientRunBefore commands. As mentioned by Simone, it's not easy to deploy scripts to 100s of machines, so... :) > > Regards, > --Simone > > > -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
Re: [Bacula-users] Running complex commands or scripts remotely on a client
> You could also use multiple ClientRunBefore statements in the config file. > Personally I would still prefer a script in the client. On my setups I use the opposite. If you need to add a line to the script, you need to copy the same script over all the clients. With multiple lines, maybe you can change just one line in the Job Definition. Don't know how many you have in your backup infrastructure, but that's not feasible at all in our setup; especially because the clients and daemons are separated by firewalls and do not allow easy copying everywhere. Regards, --Simone -- You cannot discover new oceans unless you have the courage to lose sight of the shore (R. W. Emerson). -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
Re: [Bacula-users] Running complex commands or scripts remotely on a client
Am 06.09.2012 um 09:12 schrieb "Gary R. Schmidt" : > On 6/09/2012 4:17 PM, Alex Lucas wrote: > > [SNIP] > >> It works with ";" like you mentioned above but I was asking about >> splitting the command across multiple lines in the configuration file -- >> when there are many commands it would make it easier to read. > If there are "many commands" then you would be better off putting them > into a shell script and distributing that amongst the client machines. > > Cheers, > GaryB-) > > -- > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > ___ > Bacula-users mailing list > Bacula-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bacula-users You could also use multiple ClientRunBefore statements in the config file. Personally I would still prefer a script in the client. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
Re: [Bacula-users] Running complex commands or scripts remotely on a client
On 6/09/2012 4:17 PM, Alex Lucas wrote: [SNIP] > It works with ";" like you mentioned above but I was asking about > splitting the command across multiple lines in the configuration file -- > when there are many commands it would make it easier to read. If there are "many commands" then you would be better off putting them into a shell script and distributing that amongst the client machines. Cheers, GaryB-) -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
Re: [Bacula-users] Running complex commands or scripts remotely on a client
On 06.09.2012 08:17, Alex Lucas wrote: > On 06/09/12 12:10, ganiuszka wrote: >> W dniu 06.09.2012 03:23, Alex Lucas pisze: >>> On 05/09/12 19:24, Christian Manal wrote: On 05.09.2012 12:43, Alex Lucas wrote: > Dears, > > Is there a way to run a complex command or even a script on a client? > > So far I have tried two ways and failed: > 1) when a command (e.g. in "ClientRunBeforeJob") has something like > "echo test > /tmp/test.out" bacula runs it on the client as "echo" as > command and the rest as the argument. i.e. there is no > /tmp/test.out on > the client > 2) when I run "test.sh" which is in the PATH on the bacula director it > fails, I guess because there is no identical script on the client. > > Any suggestions? Hi, all the Run-statements execute what is defined directly, without a shell. So output redirection and stuff won't work unless you do something like this: ClientRunBeforeJob = "/bin/bash -c 'echo foo >/tmp/foo.out'" >>> Thank you, this does it. One related question: is because I have a few >>> commands to run, is there a way to make the commands split across >>> several lines (for readability) ? >>> >>> e.g. >>> >>> ClientRunBeforeJob = "/bin/bash -c 'command one >>>command two'" >>> >>> doesn't seem to work. >> >> Hi, >> >> It works for me. Did you try to use semicolon character for separate >> elementary commands? >> >> Example: >> >> ClientRunBeforeJob = "/bin/bash -c 'echo aaa >/tmp/foo1.out; echo bbb >>> /tmp/foo2.out'" > Hi gani, > It works with ";" like you mentioned above but I was asking about > splitting the command across multiple lines in the configuration file -- > when there are many commands it would make it easier to read. Have you tried escaping the linebreaks with a backslash? Though, if you have multiple commands to run, I'd rather go with a separate script, instead of putting them into the config file. Regards, Christian Manal -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
Re: [Bacula-users] Running complex commands or scripts remotely on a client
On Thu, Sep 06, 2012 at 06:10:16AM +0200, ganiuszka wrote: > > It works for me. Did you try to use semicolon character for separate > elementary commands? > > Example: > > ClientRunBeforeJob = "/bin/bash -c 'echo aaa >/tmp/foo1.out; echo bbb > > /tmp/foo2.out'" > > Regards. > gani For improved readability, why not put all the commands required to run on the client into a shell script there? All the best, Uwe -- NIONEX --- Ein Unternehmen der Bertelsmann SE & Co. KGaA -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
Re: [Bacula-users] Running complex commands or scripts remotely on a client
On 06/09/12 12:10, ganiuszka wrote: > W dniu 06.09.2012 03:23, Alex Lucas pisze: >> On 05/09/12 19:24, Christian Manal wrote: >>> On 05.09.2012 12:43, Alex Lucas wrote: Dears, Is there a way to run a complex command or even a script on a client? So far I have tried two ways and failed: 1) when a command (e.g. in "ClientRunBeforeJob") has something like "echo test > /tmp/test.out" bacula runs it on the client as "echo" as command and the rest as the argument. i.e. there is no /tmp/test.out on the client 2) when I run "test.sh" which is in the PATH on the bacula director it fails, I guess because there is no identical script on the client. Any suggestions? >>> Hi, >>> >>> all the Run-statements execute what is defined directly, without a >>> shell. So output redirection and stuff won't work unless you do >>> something like this: >>> >>> ClientRunBeforeJob = "/bin/bash -c 'echo foo >/tmp/foo.out'" >> Thank you, this does it. One related question: is because I have a few >> commands to run, is there a way to make the commands split across >> several lines (for readability) ? >> >> e.g. >> >> ClientRunBeforeJob = "/bin/bash -c 'command one >>command two'" >> >> doesn't seem to work. > > Hi, > > It works for me. Did you try to use semicolon character for separate > elementary commands? > > Example: > > ClientRunBeforeJob = "/bin/bash -c 'echo aaa >/tmp/foo1.out; echo bbb > > /tmp/foo2.out'" Hi gani, It works with ";" like you mentioned above but I was asking about splitting the command across multiple lines in the configuration file -- when there are many commands it would make it easier to read. Thank you, Alex > > Regards. > gani -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
Re: [Bacula-users] Running complex commands or scripts remotely on a client
W dniu 06.09.2012 03:23, Alex Lucas pisze: > On 05/09/12 19:24, Christian Manal wrote: >> On 05.09.2012 12:43, Alex Lucas wrote: >>> Dears, >>> >>> Is there a way to run a complex command or even a script on a client? >>> >>> So far I have tried two ways and failed: >>> 1) when a command (e.g. in "ClientRunBeforeJob") has something like >>> "echo test > /tmp/test.out" bacula runs it on the client as "echo" as >>> command and the rest as the argument. i.e. there is no /tmp/test.out on >>> the client >>> 2) when I run "test.sh" which is in the PATH on the bacula director it >>> fails, I guess because there is no identical script on the client. >>> >>> Any suggestions? >> Hi, >> >> all the Run-statements execute what is defined directly, without a >> shell. So output redirection and stuff won't work unless you do >> something like this: >> >> ClientRunBeforeJob = "/bin/bash -c 'echo foo >/tmp/foo.out'" > Thank you, this does it. One related question: is because I have a few > commands to run, is there a way to make the commands split across > several lines (for readability) ? > > e.g. > > ClientRunBeforeJob = "/bin/bash -c 'command one >command two'" > > doesn't seem to work. Hi, It works for me. Did you try to use semicolon character for separate elementary commands? Example: ClientRunBeforeJob = "/bin/bash -c 'echo aaa >/tmp/foo1.out; echo bbb > /tmp/foo2.out'" Regards. gani -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
Re: [Bacula-users] Running complex commands or scripts remotely on a client
On 05/09/12 19:24, Christian Manal wrote: > On 05.09.2012 12:43, Alex Lucas wrote: >> Dears, >> >> Is there a way to run a complex command or even a script on a client? >> >> So far I have tried two ways and failed: >> 1) when a command (e.g. in "ClientRunBeforeJob") has something like >> "echo test > /tmp/test.out" bacula runs it on the client as "echo" as >> command and the rest as the argument. i.e. there is no /tmp/test.out on >> the client >> 2) when I run "test.sh" which is in the PATH on the bacula director it >> fails, I guess because there is no identical script on the client. >> >> Any suggestions? > Hi, > > all the Run-statements execute what is defined directly, without a > shell. So output redirection and stuff won't work unless you do > something like this: > >ClientRunBeforeJob = "/bin/bash -c 'echo foo >/tmp/foo.out'" Thank you, this does it. One related question: is because I have a few commands to run, is there a way to make the commands split across several lines (for readability) ? e.g. ClientRunBeforeJob = "/bin/bash -c 'command one command two'" doesn't seem to work. > > If you want to call a script, you'd have to define the absolute path or > a relative one from the executing daemon's working directory. > > > Regards, > Christian Manal > > -- > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > ___ > Bacula-users mailing list > Bacula-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bacula-users -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
Re: [Bacula-users] Running complex commands or scripts remotely on a client
On 2012-09-05 05:43, Alex Lucas wrote: > Dears, > > Is there a way to run a complex command or even a script on a client? > > So far I have tried two ways and failed: > 1) when a command (e.g. in "ClientRunBeforeJob") has something like > "echo test > /tmp/test.out" bacula runs it on the client as "echo" as > command and the rest as the argument. i.e. there is no /tmp/test.out > on > the client > 2) when I run "test.sh" which is in the PATH on the bacula director > it > fails, I guess because there is no identical script on the client. > > Any suggestions? > > > Thank you, > Alex > > > -- > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. > Discussions > will include endpoint security, mobile security and the latest in > malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > ___ > Bacula-users mailing list > Bacula-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/bacula-users Yes, use the "Client Run Before Job", and point it to a shell script that exists on the client. I use this method on my FreeBSD machines to create UFS snapshots, and mount them as read only, so I can backup the snapshots to get any open files in a consistent state, then unmount and delete the snapshots with a "Client Run After Job" script. Works like a charm, I also have some machines running PostgreSQL dumps to disk, and one running an RYSNC job, using echo commands or verbose switches within the scripts allows you to output important information into the Bacula console log so that you can easily see that the script ran successfully when checking your backup jobs. -- Thanks, Dean E. Weimer http://www.dweimer.net/ -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
Re: [Bacula-users] Running complex commands or scripts remotely on a client
Le 05/09/2012 12:43, Alex Lucas a écrit : > Dears, > > Is there a way to run a complex command or even a script on a client? > > So far I have tried two ways and failed: > 1) when a command (e.g. in "ClientRunBeforeJob") has something like > "echo test > /tmp/test.out" bacula runs it on the client as "echo" as > command and the rest as the argument. i.e. there is no /tmp/test.out on > the client > 2) when I run "test.sh" which is in the PATH on the bacula director it > fails, I guess because there is no identical script on the client. > > Any suggestions? > > > Thank you, > Alex > Hello, "Client Run Before Job" will run a command on the client ! Run Before Job will run on the director. HTH. Jérôme Blion. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
Re: [Bacula-users] Running complex commands or scripts remotely on a client
On 05.09.2012 12:43, Alex Lucas wrote: > Dears, > > Is there a way to run a complex command or even a script on a client? > > So far I have tried two ways and failed: > 1) when a command (e.g. in "ClientRunBeforeJob") has something like > "echo test > /tmp/test.out" bacula runs it on the client as "echo" as > command and the rest as the argument. i.e. there is no /tmp/test.out on > the client > 2) when I run "test.sh" which is in the PATH on the bacula director it > fails, I guess because there is no identical script on the client. > > Any suggestions? Hi, all the Run-statements execute what is defined directly, without a shell. So output redirection and stuff won't work unless you do something like this: ClientRunBeforeJob = "/bin/bash -c 'echo foo >/tmp/foo.out'" If you want to call a script, you'd have to define the absolute path or a relative one from the executing daemon's working directory. Regards, Christian Manal -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users
[Bacula-users] Running complex commands or scripts remotely on a client
Dears, Is there a way to run a complex command or even a script on a client? So far I have tried two ways and failed: 1) when a command (e.g. in "ClientRunBeforeJob") has something like "echo test > /tmp/test.out" bacula runs it on the client as "echo" as command and the rest as the argument. i.e. there is no /tmp/test.out on the client 2) when I run "test.sh" which is in the PATH on the bacula director it fails, I guess because there is no identical script on the client. Any suggestions? Thank you, Alex -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users