1

I added some jobs directly to the

/etc/crontab

file. They are running fine. However, I cannot see them if I use the ‍‍‍‍‍‍‍‍crontab‍‍ command

crontab -u <user> -l

Do I have to reindex the file somehow or could this be caused by bad formatting?

5

User crontabs are stored in /var/spool/cron/crontabs/. You can't use the crontab command to see or edit the system crontab /etc/crontab.

Note that only the system crontab contains a user field after the date. User crotab entries are always run the corresponding user so they don't need an user field.

3

No, you are using TWO different systems.

crontab -u <user> -l

will list all jobs added with crontab -e.

/etc/crontab

is not part of crontab but from another procedure.

Both are there for historical compatibility. And the big difference is permissions. User cron jobs will run with the permissions of that user, system cron jobs run with the permissions of root. /etc/crontab tried to solve that by adding a "user" to the colunms.

I would advice to pick one and stick with it. It can get messy rather quickly. My favourite is /etc/crontab unless you need to hide something then I would use crontab from "root".

2

This is normal. When you add lines on the /etc/crontab it's not really attribuate to a profile but the system.

If you want to add a crontab to an user:

crontab -e -u  <user>

The users' crontab are stored on the folder /var/spool/cron if you want to see the files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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