About nixCraft

Topics

Can I use crontab command with sys account?

Posted by Vivek Gite [Last updated: November 15, 2005]

Asked by Waman R. Kumar

Q. Ok, let me confess first, it was question asked in Linux job interview. Question was after typing crontab -u user -e or crontab -e command system gave back some error code to user, he futher told me that crond and and other utilities are installed. How to fix this problem? Not to mentioned I was unable to answer question. So what is the solution to such unseen problem?

A. crontab is the program used to install, deinstall or list the tables used to drive the cron daemon/service in Vixie Cron. Each user can have their own crontab, and though these are files in /var/spool/cron/crontabs (under Debina), they are not intended to be edited directly. So first you use crontab -e command. If variable EDITOR is not defined in your enviorment you will use ed text editor – it is a line-oriented text editor. Try following (under BASH)

$ export EDITOR=ed
$ crontab -u user -e

70
?

Type q and hit enter to exit. Now setup EDITOR to vim

$ export EDITOR=/usr/bin/vim
$ crontab -u user -e

Now it will open in vim/vi text editor. This kind of questions asked in Linux/UNIX job interview to test your basic knowledge of Operating system. So it is always good idea to define EDITOR variable in you shell startup file such as .bash_profile.

Sure you can use use crontab command with sys account too:
# crontab -u sys -e

Tell us how we're doing: Please answer a few questions about your experience to help us improve nixCraft.

You may also be interested in other helpful articles:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.