I want to use the cron in the linux redhat 7 in order to run some jobs

but I not want to use the crontab -e , since some users can change my conf

so I did the following example

cd /etc/cron.d
vi test
* * * * echo test >/tmp/test

more test
* * * * echo test >/tmp/test

so I wait one min to see the log - /tmp/test

ut log /tmp/test not created

why ?

what is wrong with my cron ?

ls -ltr
-rw-r--r--  1 root root  29 Aug  1 18:50 test

closed as unclear what you're asking by Rui F Ribeiro, Jesse_b, G-Man, Jeff Schaller, steve Aug 2 '18 at 22:02

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Could you explain what you mean by "some users may change my conf"? – Kusalananda Aug 1 '18 at 19:02
  • @Kusalananda I suspect the account is shared (known to) several different people and using /etc/cron.d isolates his script under root's control – JRFerguson Aug 1 '18 at 19:41

Your crontab has only four time and date fields. You need five to be valid.

If you are placing your script in /etc/cron.d you need to add the username that will execute the script as the first field following the standard time and date ones; like:

* * * * * yael echo test > /tmp/test

See man 5 crontab

Not the answer you're looking for? Browse other questions tagged or ask your own question.