LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-31-2013, 08:15 PM   #1
Electromancer
LQ Newbie
 
Registered: Jan 2013
Posts: 12

Rep: Reputation: Disabled
Help with command


Where is the users crontab located?
 
Old 01-31-2013, 08:17 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 7,269

Rep: Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370Reputation: 1370
A test file with entries should be in /var/spool/cron by user name.
 
1 members found this post helpful.
Old 01-31-2013, 08:28 PM   #3
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mageia, and whatever VMs I happen to be playing with
Posts: 12,280
Blog Entries: 16

Rep: Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130Reputation: 3130
If you want to create or edit a cron job as user, in a terminal as user issue the command

Code:
crontab -e
It will open the file for editing. Here's a good description of the process.

Where the crontab files are stored can vary with the distribution, but it's normally somewhere in /etc. You can use the locate command to find the files on your distro. Taking a look at man crontab and man cron can also help for your distro.

Edit: Thanks, yancek!

Last edited by frankbell; 01-31-2013 at 08:29 PM.
 
1 members found this post helpful.
Old 01-31-2013, 08:34 PM   #4
Electromancer
LQ Newbie
 
Registered: Jan 2013
Posts: 12

Original Poster
Rep: Reputation: Disabled
Hey thanks so much guys! I appreciate it.
 
Old 01-31-2013, 09:13 PM   #5
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,501

Rep: Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636
Two more things:

crontab -e fires up your favorite editor. By default that is vi/vim. If that happens not to be your favorite editor: you quit that with ESC-:q!. People have been resetting their computer because they could not think of something that obvious.

If you want a different editor, like nano, issue this command:
Code:
export VISUAL=nano
export EDITOR=nano
Or you can edit that in your ~/.bashrc.

Second, the 'e' happens to be next to the 'r' on your keyboard. When you accidently hit crontab -r instead of crontab -e your crontab is wiped out. Very convenient.

And no, I don't make backups of my clients, only servers.

jlinkels

Last edited by jlinkels; 02-01-2013 at 10:29 AM.
 
Old 02-01-2013, 12:52 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,362

Rep: Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377Reputation: 2377
To get out of vi/vim, use ' Esc :q! '
Using the 'w' will write whatever cr*p you managed to type first into the crontab; not what you want.
 
Old 02-01-2013, 10:29 AM   #7
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,501

Rep: Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636Reputation: 636
Yes, you're right! Stupid mistake!

jlinkels
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Command/Script required to send an email alert in case command will not respond rajaniyer123 Linux - General 1 05-19-2012 01:12 PM
Executing shell command from JSP file with command line arg from URL orcusomega Programming 2 01-13-2012 03:38 PM
Bash Command Line Editor, while typing run another command before executing current? gumaheru Linux - General 5 04-13-2010 11:21 AM
how to copy drive using dd and tee command parallely? source code of dd command mdfakkeer Linux - Software 1 02-10-2010 01:31 PM
LXer: The Linux Command Shell For Beginners: Fear Not The Command Line! LXer Syndicated Linux News 0 12-22-2008 06:30 PM


All times are GMT -5. The time now is 12:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration