Quantcast

Fatal error when running script with arguments

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Fatal error when running script with arguments

Kostis Fardelas
Hello community,
I am trying to run a script as a Client Run Before Job

Client Run Before Job = "/etc/bacula/scripts/mysqlxtra_dt"

The script:
#!/bin/sh

ICICMD=$(which ici)
$ICICMD -dt 3600 -svc 'mysql-replication' > /dev/null

But the job keeps failing with:
"ClientRunBeforeJob: /etc/bacula/scripts/mysqlxtra_dt: 7:
/etc/bacula/scripts/mysqlxtra_dt: -dt: not found"

What am I doing wrong?

Best regards,
Kostis

------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fatal error when running script with arguments

francisco javier funes nieto
Permissions on the script file? 
The file finish with .sh extension? 

J. 


2016-11-21 13:37 GMT+01:00 Kostis Fardelas <[hidden email]>:
Hello community,
I am trying to run a script as a Client Run Before Job

Client Run Before Job = "/etc/bacula/scripts/mysqlxtra_dt"

The script:
#!/bin/sh

ICICMD=$(which ici)
$ICICMD -dt 3600 -svc 'mysql-replication' > /dev/null

But the job keeps failing with:
"ClientRunBeforeJob: /etc/bacula/scripts/mysqlxtra_dt: 7:
/etc/bacula/scripts/mysqlxtra_dt: -dt: not found"

What am I doing wrong?

Best regards,
Kostis

------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users



--
_____________________________________________

Francisco Javier Funes Nieto [[hidden email]]
CANONIGOS
Servicios Informáticos para PYMES.
Cl. Cruz 2, 1º Oficina 7
Tlf: 958.536759 / 661134556
Fax: 958.521354
GRANADA - 18002

------------------------------------------------------------------------------

_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fatal error when running script with arguments

Bill Arlofski-4
In reply to this post by Kostis Fardelas
On 11/21/2016 07:37 AM, Kostis Fardelas wrote:

> Hello community,
> I am trying to run a script as a Client Run Before Job
>
> Client Run Before Job = "/etc/bacula/scripts/mysqlxtra_dt"
>
> The script:
> #!/bin/sh
>
> ICICMD=$(which ici)
> $ICICMD -dt 3600 -svc 'mysql-replication' > /dev/null
>
> But the job keeps failing with:
> "ClientRunBeforeJob: /etc/bacula/scripts/mysqlxtra_dt: 7:
> /etc/bacula/scripts/mysqlxtra_dt: -dt: not found"
>
> What am I doing wrong?
>
> Best regards,
> Kostis

Hi Kostis,

My fisrt guess is that $(which ici) is returning a null string, so the
variable $ICICMD is empty, and hence the command that is actually being called is

"-dt 3600 -svc 'mysql-replication' > /dev/null"

You need to double-check and verify that $(which ici) returns the full
path/filename of the command you are attempting to assign.

Best regards,

Bill



--
Bill Arlofski
http://www.revpol.com/bacula
-- Not responsible for anything below this line --

------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fatal error when running script with arguments

Kostis Fardelas
In reply to this post by francisco javier funes nieto
755 and extension is not needed. I have a lot of other scripts that do
not have extensions, but none that calls a secondary script with
arguments

On 21 November 2016 at 15:06, Francisco Javier Funes Nieto
<[hidden email]> wrote:

> Permissions on the script file?
> The file finish with .sh extension?
>
> J.
>
>
> 2016-11-21 13:37 GMT+01:00 Kostis Fardelas <[hidden email]>:
>>
>> Hello community,
>> I am trying to run a script as a Client Run Before Job
>>
>> Client Run Before Job = "/etc/bacula/scripts/mysqlxtra_dt"
>>
>> The script:
>> #!/bin/sh
>>
>> ICICMD=$(which ici)
>> $ICICMD -dt 3600 -svc 'mysql-replication' > /dev/null
>>
>> But the job keeps failing with:
>> "ClientRunBeforeJob: /etc/bacula/scripts/mysqlxtra_dt: 7:
>> /etc/bacula/scripts/mysqlxtra_dt: -dt: not found"
>>
>> What am I doing wrong?
>>
>> Best regards,
>> Kostis
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Bacula-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/bacula-users
>
>
>
>
> --
> _____________________________________________
>
> Francisco Javier Funes Nieto [[hidden email]]
> CANONIGOS
> Servicios Informáticos para PYMES.
> Cl. Cruz 2, 1º Oficina 7
> Tlf: 958.536759 / 661134556
> Fax: 958.521354
> GRANADA - 18002

------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fatal error when running script with arguments

Kostis Fardelas
In reply to this post by Bill Arlofski-4
$ICICMD has the full path. If I run the script from command line, the
script works. But if I let bacula run it, it throws a FATAL error.

On 21 November 2016 at 15:06, Bill Arlofski <[hidden email]> wrote:

> On 11/21/2016 07:37 AM, Kostis Fardelas wrote:
>> Hello community,
>> I am trying to run a script as a Client Run Before Job
>>
>> Client Run Before Job = "/etc/bacula/scripts/mysqlxtra_dt"
>>
>> The script:
>> #!/bin/sh
>>
>> ICICMD=$(which ici)
>> $ICICMD -dt 3600 -svc 'mysql-replication' > /dev/null
>>
>> But the job keeps failing with:
>> "ClientRunBeforeJob: /etc/bacula/scripts/mysqlxtra_dt: 7:
>> /etc/bacula/scripts/mysqlxtra_dt: -dt: not found"
>>
>> What am I doing wrong?
>>
>> Best regards,
>> Kostis
>
> Hi Kostis,
>
> My fisrt guess is that $(which ici) is returning a null string, so the
> variable $ICICMD is empty, and hence the command that is actually being called is
>
> "-dt 3600 -svc 'mysql-replication' > /dev/null"
>
> You need to double-check and verify that $(which ici) returns the full
> path/filename of the command you are attempting to assign.
>
> Best regards,
>
> Bill
>
>
>
> --
> Bill Arlofski
> http://www.revpol.com/bacula
> -- Not responsible for anything below this line --
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Bacula-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/bacula-users

------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fatal error when running script with arguments

Josh Fisher

On 11/21/2016 8:41 AM, Kostis Fardelas wrote:
> $ICICMD has the full path. If I run the script from command line, the
> script works. But if I let bacula run it, it throws a FATAL error.

When the bacula-fd daemon launches your script, the script inherits its
environment from the bacula-fd process. It may well be different than
the environment that gets set up when you login to a shell. In
particular, the $PATH environment variable may be different, causing
which to not find ici.

>
> On 21 November 2016 at 15:06, Bill Arlofski <[hidden email]> wrote:
>> On 11/21/2016 07:37 AM, Kostis Fardelas wrote:
>>> Hello community,
>>> I am trying to run a script as a Client Run Before Job
>>>
>>> Client Run Before Job = "/etc/bacula/scripts/mysqlxtra_dt"
>>>
>>> The script:
>>> #!/bin/sh
>>>
>>> ICICMD=$(which ici)
>>> $ICICMD -dt 3600 -svc 'mysql-replication' > /dev/null
>>>
>>> But the job keeps failing with:
>>> "ClientRunBeforeJob: /etc/bacula/scripts/mysqlxtra_dt: 7:
>>> /etc/bacula/scripts/mysqlxtra_dt: -dt: not found"
>>>
>>> What am I doing wrong?
>>>
>>> Best regards,
>>> Kostis
>> Hi Kostis,
>>
>> My fisrt guess is that $(which ici) is returning a null string, so the
>> variable $ICICMD is empty, and hence the command that is actually being called is
>>
>> "-dt 3600 -svc 'mysql-replication' > /dev/null"
>>
>> You need to double-check and verify that $(which ici) returns the full
>> path/filename of the command you are attempting to assign.
>>
>> Best regards,
>>
>> Bill
>>
>>
>>
>> --
>> Bill Arlofski
>> http://www.revpol.com/bacula
>> -- Not responsible for anything below this line --
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Bacula-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/bacula-users
> ------------------------------------------------------------------------------
> _______________________________________________
> Bacula-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/bacula-users


------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fatal error when running script with arguments

Vanush "Misha" Paturyan
In reply to this post by Kostis Fardelas
what happens if you change your script to be
ICICMD=$(/usr/bin/which ici)

or even better run "which which" on the command line and change ICICMD
to match the output.

Misha


On Mon, Nov 21, 2016 at 03:41:01PM +0200, Kostis Fardelas wrote:

> $ICICMD has the full path. If I run the script from command line, the
> script works. But if I let bacula run it, it throws a FATAL error.
>
> On 21 November 2016 at 15:06, Bill Arlofski <[hidden email]> wrote:
> > On 11/21/2016 07:37 AM, Kostis Fardelas wrote:
> >> Hello community,
> >> I am trying to run a script as a Client Run Before Job
> >>
> >> Client Run Before Job = "/etc/bacula/scripts/mysqlxtra_dt"
> >>
> >> The script:
> >> #!/bin/sh
> >>
> >> ICICMD=$(which ici)
> >> $ICICMD -dt 3600 -svc 'mysql-replication' > /dev/null
> >>
> >> But the job keeps failing with:
> >> "ClientRunBeforeJob: /etc/bacula/scripts/mysqlxtra_dt: 7:
> >> /etc/bacula/scripts/mysqlxtra_dt: -dt: not found"
> >>
> >> What am I doing wrong?
> >>
> >> Best regards,
> >> Kostis
> >
> > Hi Kostis,
> >
> > My fisrt guess is that $(which ici) is returning a null string, so the
> > variable $ICICMD is empty, and hence the command that is actually being called is
> >
> > "-dt 3600 -svc 'mysql-replication' > /dev/null"
> >
> > You need to double-check and verify that $(which ici) returns the full
> > path/filename of the command you are attempting to assign.
> >
> > Best regards,
> >
> > Bill
> >
> >
> >
> > --
> > Bill Arlofski
> > http://www.revpol.com/bacula
> > -- Not responsible for anything below this line --
> >
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Bacula-users mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/bacula-users
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Bacula-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/bacula-users

--
Vanush "Misha" Paturyan
Senior Technical Officer
Room 120
Computer Science Department
Eolas Bulding
Maynooth University
Maynooth

ext: 4539

------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fatal error when running script with arguments

Gary R. Schmidt-3
In reply to this post by Kostis Fardelas
On 22/11/2016 00:40, Kostis Fardelas wrote:

> 755 and extension is not needed. I have a lot of other scripts that do
> not have extensions, but none that calls a secondary script with
> arguments
>
> On 21 November 2016 at 15:06, Francisco Javier Funes Nieto
> <[hidden email]> wrote:
>> Permissions on the script file?
>> The file finish with .sh extension?
>>
>> J.
>>
>>
>> 2016-11-21 13:37 GMT+01:00 Kostis Fardelas <[hidden email]>:
>>>
>>> Hello community,
>>> I am trying to run a script as a Client Run Before Job
>>>
>>> Client Run Before Job = "/etc/bacula/scripts/mysqlxtra_dt"
>>>
>>> The script:
>>> #!/bin/sh
>>>
>>> ICICMD=$(which ici)
>>> $ICICMD -dt 3600 -svc 'mysql-replication' > /dev/null
>>>
>>> But the job keeps failing with:
>>> "ClientRunBeforeJob: /etc/bacula/scripts/mysqlxtra_dt: 7:
>>> /etc/bacula/scripts/mysqlxtra_dt: -dt: not found"
>>>
>>> What am I doing wrong?
>>>

First - top posting.

Second - Either "which" or "ici" (or both) are not in the limited PATH
that a bacula-fd is given.  Either specify a PATH or use full paths to
commands.

        Cheers,
               


------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Fatal error when running script with arguments

Kostis Fardelas
On 21 November 2016 at 15:58, Gary R. Schmidt <[hidden email]> wrote:

> On 22/11/2016 00:40, Kostis Fardelas wrote:
>> 755 and extension is not needed. I have a lot of other scripts that do
>> not have extensions, but none that calls a secondary script with
>> arguments
>>
>> On 21 November 2016 at 15:06, Francisco Javier Funes Nieto
>> <[hidden email]> wrote:
>>> Permissions on the script file?
>>> The file finish with .sh extension?
>>>
>>> J.
>>>
>>>
>>> 2016-11-21 13:37 GMT+01:00 Kostis Fardelas <[hidden email]>:
>>>>
>>>> Hello community,
>>>> I am trying to run a script as a Client Run Before Job
>>>>
>>>> Client Run Before Job = "/etc/bacula/scripts/mysqlxtra_dt"
>>>>
>>>> The script:
>>>> #!/bin/sh
>>>>
>>>> ICICMD=$(which ici)
>>>> $ICICMD -dt 3600 -svc 'mysql-replication' > /dev/null
>>>>
>>>> But the job keeps failing with:
>>>> "ClientRunBeforeJob: /etc/bacula/scripts/mysqlxtra_dt: 7:
>>>> /etc/bacula/scripts/mysqlxtra_dt: -dt: not found"
>>>>
>>>> What am I doing wrong?
>>>>
>
> First - top posting.
>
> Second - Either "which" or "ici" (or both) are not in the limited PATH
> that a bacula-fd is given.  Either specify a PATH or use full paths to
> commands.
>
>         Cheers,
>
>

(I tend to use the same posting style as the previous sender. You
changed that, so my turn to follow up)

Finally I found it and wanted to share. After some trial and error, I
found that the script was borking on a os.environ KeyError exception
(python) when bacula user was trying to execute it (/bin/false as
shell). Added a try/except section and everything rolls again. Thanks
a lot for you answers!

------------------------------------------------------------------------------
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Loading...