Solved

cron????

Posted on 2002-04-25
11
333 Views
Last Modified: 2010-04-22
but before we use cron to test the email, we just simply want to copy the file from one particular file e.g. file.txt to backup.txt,
but it also not function. maybe I now attach the file, so can u please help me to take a look, to see whether it has problem??


here are the steps we have done:
1. create a txt file called "file.txt"
2. create a crontab file called "mycronfile" and the command line inside the file is "7 18 25 4 4 cp ../usr/test/file.txt ../usr/test/backup.txt
"
3. put "mycronfile" to the folder ./etc/cron.d
4. In Konsole typed "crontab mycronfile"
5. But no backup.txt is created

really thanks a lot.
0
Comment
Question by:sandysansan
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 25 total points
Comment Utility
did you wait 'til 18:07 ?
0
 

Author Comment

by:sandysansan
Comment Utility
yup, I wait until 18:07, is there any problem??
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
if cron did not produce what you want at 18:07, then check roots mail, cron mails errors to root
0
 

Author Comment

by:sandysansan
Comment Utility
I have also checked mail for root, but "No mail for root"  displayed only.
Is there any special setting needed before I can checked email?
0
 
LVL 5

Assisted Solution

by:bryanh
bryanh earned 25 total points
Comment Utility
First of all, there are various cron facilities, and the one I use is probably not the one you use, so my advice could be a little off.

Cron traditionally mails all output (error messages and otherwise) to the user for whom the event was run.  Which may or may not be root.  If it isn't configured properly, it may be unable to do this mailing, though.  Another source of information about cron is syslog.  Syslog messages often go the file /var/log/messages or other files in /var/log.

As a check on what you're doing, you should run 'crontab -l'.  If you successfully installed that cron file, crontab -l should list it back to you.

And to eliminate some variables and facilitate your testing, you should make that entry * * * * * instead of 7 18 25 4 4.  That means "run once every minute."

Do you have any evidence the cron daemon is running at all?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 2

Expert Comment

by:pheur
Comment Utility
Just some notes:
- no nees to put manually the file in /etc/cron.d/. Just do
"crontab filename" or "crontab -e" and type the line there.
- specifying ALL the 5 time parameters doesn't make much sense.  Generally only some are specified, the rest being replaced by "*".

And now the fatal error: you used relative paths. DON'T ! use full paths, or use scripts that chdir to the desired directory before using relative paths.

--
Radu-Adrian Feurdean
Brainbench Linux MVP
0
 

Author Comment

by:sandysansan
Comment Utility
I have typed crontab -l
and the ouput is:

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.1276 installed on Fri May  3 02:29:53 2002)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
* * * * * root/test/test.sh

In test.sh:

#!/bin/bash
echo "`date`"
echo "--Testing cron -> mail"

I have also typed "crontab -e" and type
* * * * * root/test/test.sh

After exit to [root@XXXXX]#
I typed "mail" but display "No mail to root"

What is the problem?
anything I am wrong......Thanks a lot for your kindly help
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
silly question: did you miss a leading slash in
   root/test/test.sh
0
 
LVL 5

Expert Comment

by:bryanh
Comment Utility
You could eliminate a few variables from this test by using /bin/touch /tmp/cronisalive in place of root/test/test.sh.
That way, you're not depending on mail working, for one thing.
(but make sure you have a /bin/touch -- I'm not sure where it conventionally lives).

I still wonder if you have any evidence crond is running.  Do you see it in a ps -ax listing?  Do you see any messages from it in any log files?

Have you tried killing and restarting crond?
0
 
LVL 20

Expert Comment

by:jmcg
Comment Utility
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Split: ahoffmann {http:#6968794} & bryanh {http:#6987735}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now