7.4.x Device Resource, Alert Command documentation and usage

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

7.4.x Device Resource, Alert Command documentation and usage

Charles
How should the sample Alert Command using tapeinfo be configured?

In the Bacula Main Reference 7.4.3 (18 June 2016).pdf", section 18.3
"Device Resource" shows a sample Alert Command:

    Alert Command = "sh -c ’tapeinfo -f %c | grep TapeAlert’"

That was copied and pasted into the Bacula conf but generated:

Alert: -f: 1: -f: ’tapeinfo: not found
3997 Bad alert command: sh -c ’tapeinfo -f /dev/sg5 | grep TapeAlert’:
ERR=Child exited with code 127.

After changing the tapeinfo to /usr/sbin/tapeinfo the error messages
were similar.

After changing the ’ characters to ' characters the error messages were
similar.

The difficulty was worked around by using an external script to simplify
the conf:

     Alert Command = "/usr/local/sbin/tapealert-for-bacula.sh"

How should the sample command be configured?





------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|

Re: 7.4.x Device Resource, Alert Command documentation and usage

francisco javier funes nieto
Did you check if the mtx package was installed on the system ?

J.

2017-04-18 8:27 GMT+02:00 Charles <[hidden email]>:
How should the sample Alert Command using tapeinfo be configured?

In the Bacula Main Reference 7.4.3 (18 June 2016).pdf", section 18.3
"Device Resource" shows a sample Alert Command:

    Alert Command = "sh -c ’tapeinfo -f %c | grep TapeAlert’"

That was copied and pasted into the Bacula conf but generated:

Alert: -f: 1: -f: ’tapeinfo: not found
3997 Bad alert command: sh -c ’tapeinfo -f /dev/sg5 | grep TapeAlert’:
ERR=Child exited with code 127.

After changing the tapeinfo to /usr/sbin/tapeinfo the error messages
were similar.

After changing the ’ characters to ' characters the error messages were
similar.

The difficulty was worked around by using an external script to simplify
the conf:

     Alert Command = "/usr/local/sbin/tapealert-for-bacula.sh"

How should the sample command be configured?





------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|

Re: 7.4.x Device Resource, Alert Command documentation and usage

Charles
In reply to this post by Charles
On 18/04/17 21:19, [hidden email] wrote:

> Date: Tue, 18 Apr 2017 09:15:37 +0200
> From: Francisco Javier Funes Nieto <[hidden email]>
> Subject: Re: [Bacula-users] 7.4.x Device Resource, Alert Command
> documentation and usage
> Cc: bacula-users <[hidden email]>
> Message-ID:
> <CAKWep2XU7zBMeC-fouuO4xOb3TN5bzdSx4gbtwFpUY2K=[hidden email]>
> Content-Type: text/plain; charset="utf-8"
>
> Did you check if the mtx package was installed on the system ?
>
> J.
>
> 2017-04-18 8:27 GMT+02:00 Charles <[hidden email]>:
>
>> How should the sample Alert Command using tapeinfo be configured?
>>
>> In the Bacula Main Reference 7.4.3 (18 June 2016).pdf", section 18.3
>> "Device Resource" shows a sample Alert Command:
>>
>>     Alert Command = "sh -c ?tapeinfo -f %c | grep TapeAlert?"
>>
>> That was copied and pasted into the Bacula conf but generated:
>>
>> Alert: -f: 1: -f: ?tapeinfo: not found
>> 3997 Bad alert command: sh -c ?tapeinfo -f /dev/sg5 | grep TapeAlert?:
>> ERR=Child exited with code 127.
>>
>> After changing the tapeinfo to /usr/sbin/tapeinfo the error messages
>> were similar.
>>
>> After changing the ? characters to ' characters the error messages were
>> similar.
>>
>> The difficulty was worked around by using an external script to simplify
>> the conf:
>>
>>      Alert Command = "/usr/local/sbin/tapealert-for-bacula.sh"
>>
>> How should the sample command be configured?

Thanks Fransico

The mtx package is installed.  At a command prompt ...

     tapeinfo -f /dev/sg5 | grep TapeAlert

... runs without error as does:

     sh -c 'tapeinfo -f /dev/sg5 | grep TapeAlert'

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|

Re: 7.4.x Device Resource, Alert Command documentation and usage

francisco javier funes nieto
Last check, the user that runs the Storage Daemon (maybe bacula) has right permissions of tapinfo binary ? Maybe you have to call the tapeinfo with the path  (/usr/sbin/tapeinfo) or wherever is located in your system.  

J.



2017-04-18 19:05 GMT+02:00 Charles <[hidden email]>:
On 18/04/17 21:19, [hidden email] wrote:
> Date: Tue, 18 Apr 2017 09:15:37 +0200
> From: Francisco Javier Funes Nieto <[hidden email]>
> Subject: Re: [Bacula-users] 7.4.x Device Resource, Alert Command
>       documentation and usage
> Cc: bacula-users <[hidden email]>
> Message-ID:
>       <CAKWep2XU7zBMeC-fouuO4xOb3TN5bzdSx4gbtwFpUY2K=[hidden email]>
> Content-Type: text/plain; charset="utf-8"
>
> Did you check if the mtx package was installed on the system ?
>
> J.
>
> 2017-04-18 8:27 GMT+02:00 Charles <[hidden email]>:
>
>> How should the sample Alert Command using tapeinfo be configured?
>>
>> In the Bacula Main Reference 7.4.3 (18 June 2016).pdf", section 18.3
>> "Device Resource" shows a sample Alert Command:
>>
>>     Alert Command = "sh -c ?tapeinfo -f %c | grep TapeAlert?"
>>
>> That was copied and pasted into the Bacula conf but generated:
>>
>> Alert: -f: 1: -f: ?tapeinfo: not found
>> 3997 Bad alert command: sh -c ?tapeinfo -f /dev/sg5 | grep TapeAlert?:
>> ERR=Child exited with code 127.
>>
>> After changing the tapeinfo to /usr/sbin/tapeinfo the error messages
>> were similar.
>>
>> After changing the ? characters to ' characters the error messages were
>> similar.
>>
>> The difficulty was worked around by using an external script to simplify
>> the conf:
>>
>>      Alert Command = "/usr/local/sbin/tapealert-for-bacula.sh"
>>
>> How should the sample command be configured?

Thanks Fransico

The mtx package is installed.  At a command prompt ...

     tapeinfo -f /dev/sg5 | grep TapeAlert

... runs without error as does:

     sh -c 'tapeinfo -f /dev/sg5 | grep TapeAlert'

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
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

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|

Re: 7.4.x Device Resource, Alert Command documentation and usage

Charles
In reply to this post by Charles
Thanks Javier :-)

Exit code 127 normally means the command is not found rather than that
the command is found but does not have the correct permissions.  In my
first post I described trying /usr/sbin/tapeinfo and getting similar
results.

bacula-sd runs as user bacula and group tape.  "Other" permissions look OK:
# ls -l /usr/sbin/tapeinfo
-rwxr-xr-x 1 root root 44400 Oct 24  2014 /usr/sbin/tapeinfo
# ls -ld /usr/sbin
drwxr-xr-x 2 root root 12288 Apr 18 06:35 /usr/sbin

/usr/sbin/tapeinfo runs as bacula with group tape (after changing
bacula's shell from /bin/false):

# su -c 'sg tape -c /bin/bash' bacula
bash: cannot set terminal process group (8642): Inappropriate ioctl for
device
bash: no job control in this shell
$ id
uid=112(bacula) gid=26(tape) groups=26(tape),119(bacula)
$ /usr/sbin/tapeinfo -f /dev/st0
cannot open SCSI device '/dev/st0' - No medium found

I believe I am doing something stupid in the conf file causing bacula-sd
to attempt to run a command other than (/usr/sbin/)tapeinfo, perhaps
with a quote included in the name or with the arguments not separated
from the command word.

Here's the first attempt, copied and pasted from the Main Reference
(.bu0 means "backup 0"):

# grep '^ .*Alert' bacula-sd.conf.bu0
     Alert Command = "sh -c ’tapeinfo -f %c | grep TapeAlert’

Charles

On 24/04/17 17:57, [hidden email] wrote:

> Date: Tue, 18 Apr 2017 21:13:19 +0200
> From: Francisco Javier Funes Nieto <[hidden email]>
> Subject: Re: [Bacula-users] 7.4.x Device Resource, Alert Command
> documentation and usage
> Cc: bacula-users <[hidden email]>
> Message-ID:
> <[hidden email]>
> Content-Type: text/plain; charset="utf-8"
>
> Last check, the user that runs the Storage Daemon (maybe bacula) has right
> permissions of tapinfo binary ? Maybe you have to call the tapeinfo with
> the path  (/usr/sbin/tapeinfo) or wherever is located in your system.
>
> J.
>
>
>
> 2017-04-18 19:05 GMT+02:00 Charles <[hidden email]>:
>
>> On 18/04/17 21:19, [hidden email] wrote:
>>> Date: Tue, 18 Apr 2017 09:15:37 +0200
>>> From: Francisco Javier Funes Nieto <[hidden email]>
>>> Subject: Re: [Bacula-users] 7.4.x Device Resource, Alert Command
>>>       documentation and usage
>>> Cc: bacula-users <[hidden email]>
>>> Message-ID:
>>>       <CAKWep2XU7zBMeC-fouuO4xOb3TN5bzdSx4gbtwFpUY2K=
>> [hidden email]>
>>> Content-Type: text/plain; charset="utf-8"
>>>
>>> Did you check if the mtx package was installed on the system ?
>>>
>>> J.
>>>
>>> 2017-04-18 8:27 GMT+02:00 Charles <[hidden email]>:
>>>
>>>> How should the sample Alert Command using tapeinfo be configured?
>>>>
>>>> In the Bacula Main Reference 7.4.3 (18 June 2016).pdf", section 18.3
>>>> "Device Resource" shows a sample Alert Command:
>>>>
>>>>     Alert Command = "sh -c ?tapeinfo -f %c | grep TapeAlert?"
>>>>
>>>> That was copied and pasted into the Bacula conf but generated:
>>>>
>>>> Alert: -f: 1: -f: ?tapeinfo: not found
>>>> 3997 Bad alert command: sh -c ?tapeinfo -f /dev/sg5 | grep TapeAlert?:
>>>> ERR=Child exited with code 127.
>>>>
>>>> After changing the tapeinfo to /usr/sbin/tapeinfo the error messages
>>>> were similar.
>>>>
>>>> After changing the ? characters to ' characters the error messages were
>>>> similar.
>>>>
>>>> The difficulty was worked around by using an external script to simplify
>>>> the conf:
>>>>
>>>>      Alert Command = "/usr/local/sbin/tapealert-for-bacula.sh"
>>>>
>>>> How should the sample command be configured?
>> Thanks Fransico
>>
>> The mtx package is installed.  At a command prompt ...
>>
>>      tapeinfo -f /dev/sg5 | grep TapeAlert
>>
>> ... runs without error as does:
>>
>>      sh -c 'tapeinfo -f /dev/sg5 | grep TapeAlert'

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users
Reply | Threaded
Open this post in threaded view
|

Re: 7.4.x Device Resource, Alert Command documentation and usage

Kern Sibbald
Hello Charles,

You need to specify the SCSI control device for the tapeinfo command and
not the tape device.  Probably you want /dev/sgN where N is probably 2
or 3, but it is best to do an "lsscsi -g" to find out the right name.  
It the control device is listed last column of every line following the
normal device name.

Best regards,

Kern


On 04/24/2017 04:01 PM, Charles wrote:

> Thanks Javier :-)
>
> Exit code 127 normally means the command is not found rather than that
> the command is found but does not have the correct permissions.  In my
> first post I described trying /usr/sbin/tapeinfo and getting similar
> results.
>
> bacula-sd runs as user bacula and group tape.  "Other" permissions look OK:
> # ls -l /usr/sbin/tapeinfo
> -rwxr-xr-x 1 root root 44400 Oct 24  2014 /usr/sbin/tapeinfo
> # ls -ld /usr/sbin
> drwxr-xr-x 2 root root 12288 Apr 18 06:35 /usr/sbin
>
> /usr/sbin/tapeinfo runs as bacula with group tape (after changing
> bacula's shell from /bin/false):
>
> # su -c 'sg tape -c /bin/bash' bacula
> bash: cannot set terminal process group (8642): Inappropriate ioctl for
> device
> bash: no job control in this shell
> $ id
> uid=112(bacula) gid=26(tape) groups=26(tape),119(bacula)
> $ /usr/sbin/tapeinfo -f /dev/st0
> cannot open SCSI device '/dev/st0' - No medium found
>
> I believe I am doing something stupid in the conf file causing bacula-sd
> to attempt to run a command other than (/usr/sbin/)tapeinfo, perhaps
> with a quote included in the name or with the arguments not separated
> from the command word.
>
> Here's the first attempt, copied and pasted from the Main Reference
> (.bu0 means "backup 0"):
>
> # grep '^ .*Alert' bacula-sd.conf.bu0
>       Alert Command = "sh -c ’tapeinfo -f %c | grep TapeAlert’
>
> Charles
>
> On 24/04/17 17:57, [hidden email] wrote:
>> Date: Tue, 18 Apr 2017 21:13:19 +0200
>> From: Francisco Javier Funes Nieto <[hidden email]>
>> Subject: Re: [Bacula-users] 7.4.x Device Resource, Alert Command
>> documentation and usage
>> Cc: bacula-users <[hidden email]>
>> Message-ID:
>> <[hidden email]>
>> Content-Type: text/plain; charset="utf-8"
>>
>> Last check, the user that runs the Storage Daemon (maybe bacula) has right
>> permissions of tapinfo binary ? Maybe you have to call the tapeinfo with
>> the path  (/usr/sbin/tapeinfo) or wherever is located in your system.
>>
>> J.
>>
>>
>>
>> 2017-04-18 19:05 GMT+02:00 Charles <[hidden email]>:
>>
>>> On 18/04/17 21:19, [hidden email] wrote:
>>>> Date: Tue, 18 Apr 2017 09:15:37 +0200
>>>> From: Francisco Javier Funes Nieto <[hidden email]>
>>>> Subject: Re: [Bacula-users] 7.4.x Device Resource, Alert Command
>>>>        documentation and usage
>>>> Cc: bacula-users <[hidden email]>
>>>> Message-ID:
>>>>        <CAKWep2XU7zBMeC-fouuO4xOb3TN5bzdSx4gbtwFpUY2K=
>>> [hidden email]>
>>>> Content-Type: text/plain; charset="utf-8"
>>>>
>>>> Did you check if the mtx package was installed on the system ?
>>>>
>>>> J.
>>>>
>>>> 2017-04-18 8:27 GMT+02:00 Charles <[hidden email]>:
>>>>
>>>>> How should the sample Alert Command using tapeinfo be configured?
>>>>>
>>>>> In the Bacula Main Reference 7.4.3 (18 June 2016).pdf", section 18.3
>>>>> "Device Resource" shows a sample Alert Command:
>>>>>
>>>>>      Alert Command = "sh -c ?tapeinfo -f %c | grep TapeAlert?"
>>>>>
>>>>> That was copied and pasted into the Bacula conf but generated:
>>>>>
>>>>> Alert: -f: 1: -f: ?tapeinfo: not found
>>>>> 3997 Bad alert command: sh -c ?tapeinfo -f /dev/sg5 | grep TapeAlert?:
>>>>> ERR=Child exited with code 127.
>>>>>
>>>>> After changing the tapeinfo to /usr/sbin/tapeinfo the error messages
>>>>> were similar.
>>>>>
>>>>> After changing the ? characters to ' characters the error messages were
>>>>> similar.
>>>>>
>>>>> The difficulty was worked around by using an external script to simplify
>>>>> the conf:
>>>>>
>>>>>       Alert Command = "/usr/local/sbin/tapealert-for-bacula.sh"
>>>>>
>>>>> How should the sample command be configured?
>>> Thanks Fransico
>>>
>>> The mtx package is installed.  At a command prompt ...
>>>
>>>       tapeinfo -f /dev/sg5 | grep TapeAlert
>>>
>>> ... runs without error as does:
>>>
>>>       sh -c 'tapeinfo -f /dev/sg5 | grep TapeAlert'
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Bacula-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/bacula-users
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/bacula-users