[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

cron????

Posted on 2002-04-25
11
Medium Priority
?
372 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 6968794
did you wait 'til 18:07 ?
0
 

Author Comment

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

Expert Comment

by:ahoffmann
ID: 6972987
if cron did not produce what you want at 18:07, then check roots mail, cron mails errors to root
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 

Author Comment

by:sandysansan
ID: 6975273
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 100 total points
ID: 6982523
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
 
LVL 2

Expert Comment

by:pheur
ID: 6983096
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
ID: 6986960
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
ID: 6987089
silly question: did you miss a leading slash in
   root/test/test.sh
0
 
LVL 5

Expert Comment

by:bryanh
ID: 6987735
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
ID: 9901600
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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 video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

650 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