Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Normally, you use the command crontab -e to edit your personal cron jobs. Once you've typed that, you'd get a list of your cron jobs which you can change or add to. For example, to run the ping command at 9am and 1pm from Monday to Friday, you could use:
That looks about right, but it tells me something worrying - you are using your root user as your normal day-to-day user, logging in graphically. This is generally not a good idea - you should create a non-privileged user for day-to-day use, and switch to root to perform only those tasks which require it. From the shell you can use su and/or sudo, and from the GUI you can use gksu / gksudo (comes with gnome desktop), or kdesu (comes with KDE desktop).
If you add a job in crontab for testing, make sure you add it a minute or two in advance of the job running... cron starts jobs at the beginning of the minute you specify, so if you save the crontab after :00 seconds in that minute, it's too late and the job will not execute.
First thing to check - that your job works when you run it from the command line. i.e. execute this command from the command line as the same user whose crontab you are editing:
Maybe that user doesn't have permission to write to the file /var/log/printerCheckLog?
You can also check the local mail for that user. Errors (or in fact any output from cron jobs) is sent there. It depends on the distro because configurations vary, but usually you will need to set up your mail client to read local mail from the mbox file /var/mail/yourusername.
A command-line mail client like mailx can be useful here, or if you want to go hardcore, just read the /var/mail/yourusername file with less and search for the Subject: header to locate each message.
first thanks for your reply about not using root as a day to day user..i already have another user account. i am using root only for administration tasks.
here is log of what i have done..
Code:
mars:~ # /bin/ping -c 5 mfc-printer > /root/Desktop/PrinterCheckLog
mars:~ # cd /root/Desktop/
mars:~/Desktop # ls Prin*
Printer.desktop PrinterCheckLog
mars:~/Desktop # vi PrinterCheckLog
i have run the command on terminal, everything was fine. running vi, i was able to read the log.
Code:
mars:~/Desktop # rm PrinterCheckLog
You have mail in /var/spool/mail/root
mars:~/Desktop # date
Thu Nov 8 10:34:22 CET 2007
mars:~/Desktop # crontab -e
crontab: installing new crontab
mars:~/Desktop # crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.XXXXgJiVKd installed on Thu Nov 8 10:34:38 2007)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
38 6,10,12,18 * * * ping -c 5 mfc-printer > /var/log/printerCheckLog
# This file was written by KCron. Copyright (c) 1999, Gary Meyer
# Although KCron supports most crontab formats, use care when editing.
# Note: Lines beginning with "#\" indicates a disabled task.
as i deleted the old log file, there appeared a mail notification (after i started mailx) how can i deactivate it ?
anyway i edited the crontab file..and now at 10:42 there is no log file..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.