[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to run bash script?
From: |
Martin Pala |
Subject: |
Re: How to run bash script? |
Date: |
Thu, 20 Mar 2014 23:03:04 +0100 |
Does the "/bin/bash" exist on your system? (the "sh" was used in the test which
you did on command line):
ls -l /bin/bash
Regards,
Martin
On 20 Mar 2014, at 22:50, Martin Vaner <address@hidden> wrote:
> Hi Martin,
>
> outputs are:
>
> address@hidden:/usr/local/bin# ls -l logtest.sh
> -rwxr-xr-x 1 root staff 345 Mar 20 14:47 logtest.sh
> address@hidden:/usr/local/bin# file logtest.sh
> logtest.sh: ASCII text
> address@hidden:/usr/local/bin#
>
> Thanks,
>
> Martin
>
>
> Dne 20.3.2014 22:23, Martin Pala napsal(a):
>> Hi,
>>
>> the file should be executable (for example mode 0755). Please can you
>> provide output of following commands?:
>>
>> 1.) ls -l /usr/local/bin/logtest.sh
>> 2.) file /usr/local/bin/logtest.sh
>>
>> Regards,
>> Martin
>>
>>
>>
>> On 20 Mar 2014, at 17:06, Martin Vaner <address@hidden> wrote:
>>
>>> Hi,
>>>
>>> sure, i did set premissions of the file correctly.
>>>
>>>
>>>
>>>
>>> Dne 20.3.2014 16:18, address@hidden napsal(a):
>>>> Did you set the permission of the script ? And added #!/bin/bash
>>>>
>>>> Sent from my iPhone 5
>>>>
>>>> On 20 Mar 2014, at 4:09 PM, Martin Vaner <address@hidden> wrote:
>>>>
>>>>> Same problem. The console output is:
>>>>>
>>>>> address@hidden:/mnt/vouchers# sh /usr/local/bin/logtest.sh
>>>>> 0
>>>>>
>>>>> Monit is saying:
>>>>>
>>>>> failed to execute '/etc/monit/scripts/contego_logtest' -- Exec format
>>>>> error
>>>>>
>>>>> I do not know more what can i do.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Dne 20.3.2014 14:45, admin-at-extremeshok-dot-com napsal(a):
>>>>>> Should work ;-P
>>>>>>
>>>>>> ## eXtremeSHOK.com
>>>>>> errorcount=`tail -n 10 /mnt/vouchers/contego.log | grep "Error" | wc -l`
>>>>>> if [ $errorcount -gt 0 ] ; then
>>>>>> echo "OK working"
>>>>>> exit 0
>>>>>> else
>>>>>> echo "$errorcount" 1>&2;
>>>>>> exit 10
>>>>>> fi
>>>>>> ## eXtremeSHOK.com
>>>>>>
>>>>>>
>>>>>> On 3/20/2014 3:39 PM, Martin Vaner wrote:
>>>>>>> Hello all,
>>>>>>>
>>>>>>> i have a one question.
>>>>>>> I am using monit to monitor all of our servers all around the world,
>>>>>>> but i have a little problem in this moment.
>>>>>>>
>>>>>>> I need to monitor one log file using external bash script (logtest.sh):
>>>>>>>
>>>>>>> #!/bin/bash
>>>>>>> errorcount=`tail -n 10 /mnt/vouchers/contego.log | grep "Error" | wc -l`
>>>>>>> if [ $errorcount -gt 0 ]; then
>>>>>>> exit 0;
>>>>>>> else
>>>>>>> exit $?;
>>>>>>> fi
>>>>>>>
>>>>>>> So, when i run this script from the console, it is working fine. I
>>>>>>> tried to do test in the monitrc file, as described here:
>>>>>>> http://goo.gl/LviXBV (monit official how to):
>>>>>>>
>>>>>>> check program contego_errors with path /usr/local/bin/logtest.sh
>>>>>>> if status != 0 then alert
>>>>>>>
>>>>>>> I also tried to put quotes in the path, but monit still getting this
>>>>>>> error:
>>>>>>>
>>>>>>> Failed to execute '/usr/local/bin/logtest.sh' -- Exec format error
>>>>>>>
>>>>>>> Do you have some tips & tricks, how can i run this script to test what
>>>>>>> i need? I also tried something like:
>>>>>>>
>>>>>>> "/bin/bash '/usr/local/bin/logtest.sh'" and any other combinations of
>>>>>>> "" and '' ... And i am still getting the same error.
>>>>>>>
>>>>>>> Thank you,
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Martin
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> To unsubscribe:
>>>>>>>
>>>>>>> https://lists.nongnu.org/mailman/listinfo/monit-general
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> To unsubscribe:
>>>>>>
>>>>>> https://lists.nongnu.org/mailman/listinfo/monit-general
>>>>>
>>>>> --
>>>>> To unsubscribe:
>>>>> https://lists.nongnu.org/mailman/listinfo/monit-general
>>>>
>>>>
>>>> --
>>>> To unsubscribe:
>>>>
>>>> https://lists.nongnu.org/mailman/listinfo/monit-general
>>>
>>> --
>>> To unsubscribe:
>>> https://lists.nongnu.org/mailman/listinfo/monit-general
>>
>>
>>
>> --
>> To unsubscribe:
>>
>> https://lists.nongnu.org/mailman/listinfo/monit-general
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general
- How to run bash script?, Martin Vaner, 2014/03/20
- Re: How to run bash script?, admin-at-extremeshok-dot-com, 2014/03/20
- Re: How to run bash script?, Martin Vaner, 2014/03/20
- Re: How to run bash script?, address@hidden, 2014/03/20
- Re: How to run bash script?, Martin Vaner, 2014/03/20
- Re: How to run bash script?, Martin Pala, 2014/03/20
- Re: How to run bash script?, Martin Vaner, 2014/03/20
- Re: How to run bash script?,
Martin Pala <=
- Re: How to run bash script?, Martin Vaner, 2014/03/20
- Re: How to run bash script?, Martin Pala, 2014/03/20
- Re: How to run bash script?, Martin Vaner, 2014/03/20
- Re: How to run bash script?, Werner Flamme, 2014/03/22
Re: How to run bash script?, admin-at-extremeshok-dot-com, 2014/03/20