Is there a way to schedule a task using crontab by root user but should not be visible using crontab command i.e,
crontab -l either for root user or normal users?
If you want to schedule a task using
cron, an alternative to
crontab in many distributions is to add a file to
/etc/cron.d, in the traditional system
crontab format (the variant which specifies the user). Tasks defined in this way do not show up in
crontab -l's output.
For example, on Debian,
amavisd-new's Spamassassin maintenance is scheduled by
/etc/cron.d/amavisd-new, which contains
# # SpamAssassin maintenance for amavisd-new # # m h dom mon dow user command 18 */3 * * * amavis test -e /usr/sbin/amavisd-new-cronjob && /usr/sbin/amavisd-new-cronjob sa-sync 24 1 * * * amavis test -e /usr/sbin/amavisd-new-cronjob && /usr/sbin/amavisd-new-cronjob sa-clean