crontab bash tests

lejeczek peljasz at yahoo.co.uk
Sun Sep 24 16:44:18 UTC 2023


Hi guys.

I have this

*/1 * * * * { [[ $(/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; }

which in regular shell session touches the file, but in the 
cron file gets removed, the opposite & actually the only 
outcome, regardless of whether the test is true or false.
What is going on there?
many thanks, L.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20230924/2c4c49fc/attachment.html>


More information about the ubuntu-users mailing list