crontab bash tests

Ralf Mardorf kde.lists at yahoo.com
Tue Sep 26 09:36:09 UTC 2023


On Tue, 2023-09-26 at 16:41 +1000, Karl Auer wrote:
> You could try running /bin/sh at the command line then seeing if your
> command line works. Might give you a clue.

Hi,

the user's login shell might not be the same as the /usr/bin/sh link ;).

However, why not instead of running an endless unreadable line with or
without bashisms

[[ $(/usr/bin/sudo -u postgres /usr/bin/psql --quiet --port=5433 -x -c 'select state from pg_stat_replication;' | grep streaming > /dev/null)$? -eq 0 ]] && /usr/bin/touch /tmp/pgSQL-5433.isMaster || rm -f /tmp/pgSQL-5433.isMaster;

just run a human readable script

/usr/local/sbin/your_script

The "your_script" could belong to a group and/or use special permission
flags to get rid of the sudo and it can be formatted to be human
readable with or without bashisms.

Regards,
Ralf




More information about the ubuntu-users mailing list