# Where is the user crontab file located?



## dmetzcher (Nov 28, 2005)

Can someone please tell me the path of the user crontab?

My apologies is this has already been answered. I did a search and couldn't find anything.

Thanks.


----------



## mosx86 (Nov 29, 2005)

dmetzcher said:
			
		

> Can someone please tell me the path of the user crontab?
> 
> My apologies is this has already been answered. I did a search and couldn't find anything.
> 
> Thanks.



They should be in /var/cron/tabs

You don't typically edit them manually though.  I would suggest you read the man page.


----------



## barhar (Nov 29, 2005)

'... please tell me the path of the user crontab', '/private/etc/' [ok, this is the 'root' level crontab - 29 Nov. 2005, 17.05].

A suggestion:
Make a copy (and rename it, such as 'crontab_') before editing the original 'crontab' file.

If you do edit the 'crontab' file, as any (log'ed in) user but 'root', remember to change the owner to 'root' ('system' via file's 'Get Info' window) and group to 'wheel'.


----------



## dmetzcher (Nov 29, 2005)

Thanks to both of you! I found it. I found a crontab in '/var/cron/tabs/' named after my user name.

Just so I am perfectly clear, if I edit this crontab using the following command in the Terminal:
$ sudo pico /var/cron/tabs/[crontab-name]
...I won't have to change the owner to root and the group to wheel in the Finder. Correct?

Honestly, I use CronniX to edit my crontab files, but I wanted to know how to do it from the Terminal, so this is more of a learning excercise.

Thanks again!


----------



## BjarneDM (Nov 29, 2005)

1) the systemwide crontab file in /etc/crontab is edited normally with eg 'sudo pico /etc/crontab'
2) the user specific crontab files are editied using the 'crontab' command. See 'man crontab' on how to use it.


----------



## applemaz (Nov 29, 2005)

For the cron under your personal account, you can simply say:
$ crontab -e   --> This will bring you into edit mode.  You don't need to know the files location.

To erase the cron file, just type --> $ crontab -r

To list the current cron contents type --> $ crontab -l

You can use Pico, emacs or vi to create a new cron file with times and files to execute and then type --> $ cron filename

I don't think you want to fool around with the root users cron file.  Each user (if enabled) can have their own cron file and they won't clobber other users (or the root users) cron.


----------



## dmetzcher (Nov 29, 2005)

BjarneDM said:
			
		

> 1) the systemwide crontab file in /etc/crontab is edited normally with eg 'sudo pico /etc/crontab'
> 2) the user specific crontab files are editied using the 'crontab' command. See 'man crontab' on how to use it.


Thanks. I found that 'crontab -e' does this for me, but I was wondering more about being to edit another user's crontab, which this command will not let me do. For my own crontab, it's certainly easier though.


----------



## BjarneDM (Nov 29, 2005)

Read the 'man 1 crontab' again for an answer to your problem
And the 'man 5 crontab' will provide further information on the format of the entries in the crontab files.


----------

