help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unable to run bash loadable in crontab on Mac OS X


From: Peng Yu
Subject: Re: Unable to run bash loadable in crontab on Mac OS X
Date: Wed, 30 Aug 2023 22:04:47 -0500

https://apple.stackexchange.com/questions/378553/crontab-operation-not-permitted

It sounds like it is a cron permission problem. Users have to give
permission to cron explicitly on Mac OS X. Otherwise, there will be
trouble to use `enable` in bash. I am not sure why it is so. Is there
a way to make bash not be dependent on such a permissions issue?

On Tue, Aug 29, 2023 at 2:00 PM Peng Yu <pengyu.ut@gmail.com> wrote:
>
> Hi,
>
> I have the following line in crontab.
>
> $ crontab -l
> * * * * * LANG=en_US.UTF-8 /usr/local/bin/bash -c 'export
> BASH_LOADABLES_PATH=$HOME/Downloads/bash-5.2.15/examples/loadables;
> builtin enable -f realpath realpath' >/tmp/crontab_stdout.log
> 2>/tmp/crontab_stderr.log
>
> The shared library file realpath is there.
>
> $ cd $HOME/Downloads/bash-5.2.15/examples/loadables
> $ ls -lgG realpath
> -rwxr-xr-x 1 51288 2023-08-17 08:01:49 realpath
> $ file realpath
> realpath: Mach-O 64-bit dynamically linked shared library x86_64
> $ /usr/local/bin/bash --version | head -n 1
> GNU bash, version 5.2.15(1)-release (x86_64-apple-darwin21.6.0)
>
> But I see the following error.
>
> $ cat /tmp/crontab_stderr.log
> /usr/local/bin/bash: line 1: enable: cannot open shared object
> realpath: dlopen(realpath, 0x0001): tried: 'realpath' (no such file),
> '/usr/local/lib/realpath' (no such file), '/usr/lib/realpath' (no such
> file), '/Users/pengy/realpath' (no such file)
>
> The command `builtin enable -f realpath realpath` can run correctly in
> a login bash session.
>
> Why can't it run in crontab? Thanks.
>
> --
> Regards,
> Peng



-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]