L
L
Lorem Ipsum2020-06-01 16:46:30
Task Schedulers
Lorem Ipsum, 2020-06-01 16:46:30

How is this line decoded by cron?

Hello.

Can you please tell me how this string is decoded?
(about the fact that it starts every minute, with root rights, then the script is apparently launched (but there is no path to php, it just goes further) and what are the curly brackets?
What does 2>&1 mean ?

* * * * * root test -f /home/bitrix/www/hook/log.php?test=1 && { /usr/bin/php -f /home/bitrix/www/hook/log.php?test=1; } > /dev/null 2>&1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
galaxy, 2020-06-01
@ImpAnonym

test -f /home/bitrix/www/hook/log.php?test=1 - check that the file exists
&& - if the first command succeeds (i.e. when the file exists), execute the second
{ ...; } - output grouping, I don't know why it is here, given that there is only one command in brackets. Possibly an artifact, and there used to be a few commands

/usr/bin/php -f /home/bitrix/www/hook/log.php?test=1;
- execute file - redirect command output to / dev
> /dev/null /null (i.e. ignore)
2>&1in short, so that all program output ends up in / dev / null

D
Dmitry, 2020-06-01
@Tabletko

Direct error output to standard output

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question