We have a machine that executes cron jobs. We'd like to upload (via scp) cron job files to. Here is an example of a cron job file (test.cron):
* * * * * echo "test" > /tmp/test_cron
This runs if you do it using crontab -e
then save, and then that ends up in /var/spool/cron/crontabs/$USER
, we can't use this anymore (company policy).
If I place this file test.cron
in the /etc/cron.d
it doesn't run. Do I need to change this file syntax or put this file elsewhere so it's picked up by cron deamon and ran?
Update:
When I paste contents of the test.cron
into crontab -e
it gets executed. My crontab syntax seems to be valid.
My question is: Where do I need to put/drop/place test.cron
file with the content above, so that it gets picked up by cron daemon?
More context: I don't know in advance at what interval the cron file command will need to be ran. None of these are probably a good place "cron.daily/ cron.hourly/ cron.monthly/ cron.weekly/" I could be wrong that's why I'm asking this question.
/var/spool/cron/crontabs/$USER
, we can't use this anymore (company policy)." What is your actual policy? What needs to be achieved there? Because opening up root SFTP access (needed to drop files into/etc/cron.d
) is hardly an improvement compared to allowing a regular user to manage their own cronjobs IMHO