Peter
Peter

Reputation: 87

does $crontab -e eventually updates /etc/crontab?

I'm digging along CRON and scheduling. I setup a scheduled job to fire every minute via $crontab -e + editing the file (weirdly named "/tmp/crontab.vst6TX/crontab")

My understanding is that $crontab -e opens A crontab... and that cron.d, the daemon, picks up the crontab and APPENDS the cron job within to the (systemwide) /etc/crontab. (as per comment from crontab being saved in tmp/ in debian)

I'm watching the cron job fire every minute - yet I can't see it being added to the /etc/crontab job list... why? $crontab -l does show the job...

Upvotes: 1

Views: 343

Answers (1)

drewyupdrew
drewyupdrew

Reputation: 1609

crontab -e and crontab -l are to edit and display (respectively) the current user's crontab file (which are physically located in /var/spool/cron/crontabs). Therefore, each user can have their own separate crontab file in that directory. So when you ran crontab -e and added a cron line, you ran crontab -l as the same user presumably, and therefore saw the line you added.

/etc/crontab is a completely different file. You are correct, it is systemwide -- notice that the cron lines in that file specify a user. The same is true for files in /etc/cron.d, the cron lines in the files will specify a user.

Oh and also, the .d suffix in cron.d does not refer to daemon. Check this post out.

Upvotes: 1

Related Questions