LinuxQuestions.org
Visit Jeremy's Blog.
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, 09: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, 09:17 PM   #2
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 6,872

Rep: Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249Reputation: 1249
A test file with entries should be in /var/spool/cron by user name.
 
1 members found this post helpful.
Old 01-31-2013, 09:28 PM   #3
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Debian, Mint, OpenBSD
Posts: 11,358
Blog Entries: 12

Rep: Reputation: 2740Reputation: 2740Reputation: 2740Reputation: 2740Reputation: 2740Reputation: 2740Reputation: 2740Reputation: 2740Reputation: 2740Reputation: 2740Reputation: 2740
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 09:29 PM.
 
1 members found this post helpful.
Old 01-31-2013, 09: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, 10:13 PM   #5
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,493

Rep: Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635
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 11:29 AM.
 
Old 02-01-2013, 01:52 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
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, 11:29 AM   #7
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,493

Rep: Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635Reputation: 635
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 02:12 PM
Executing shell command from JSP file with command line arg from URL orcusomega Programming 2 01-13-2012 04:38 PM
Bash Command Line Editor, while typing run another command before executing current? gumaheru Linux - General 5 04-13-2010 12:21 PM
how to copy drive using dd and tee command parallely? source code of dd command mdfakkeer Linux - Software 1 02-10-2010 02:31 PM
LXer: The Linux Command Shell For Beginners: Fear Not The Command Line! LXer Syndicated Linux News 0 12-22-2008 07:30 PM


All times are GMT -5. The time now is 05:46 PM.

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