Queries about crontab settings


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Queries about crontab settings
# 1  
Old 10-23-2009
Queries about crontab settings

Hi,

I've set a cron job using crontab -e to backup databases in my server using the automysql backup script.

I've set it to backup daily at 5.00 p.m. This works fine :

Code:
00 17 * * * sh /etc/cron.daily/automysqlbackup.sh.2.5

But there is another default file, named 'crontab' in the /etc directory that has default settings to perform cron jobs at 4.02 a.m. daily :

Code:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

So the problem now is, the database backs up daily at 4.02 a.m and 5.00 p.m.

How do I stop the cron from backing up at 4.02 a.m? I only want to have the backups at 5.00 p.m.

Should I remove the crontab file completely from the /etc directory?

Last edited by pludi; 10-23-2009 at 03:06 AM.. Reason: code tags
# 2  
Old 10-23-2009
From the look of it, I'd say Debian, or one of it's derivates. If so, the run-parts script goes through the directory /etc/cron.daily on the specified time, and runs all executable files therein. This is very useful for scripts that have to run at this interval (say, logrotation) and do not require any command line options, as you can use an existing script and easily turn it into an automated job. Same for cron.weekly, cron.monthly, ...

Put the backup script into another location (say for example /root/bin) and change your crontab entry accordingly.
# 3  
Old 10-25-2009
Backup problems

Well I have performed as mentioned, it work fine but the only problem is, the database is not backed up on Saturdays. It is backed up on Sundays, but not Saturdays.

Why does this problem occur and how do I solve it?
# 4  
Old 10-26-2009
Code:
22 4 * * 0 root run-parts /etc/cron.weekly

0 is sunday as explained here in "man 5 crontab".

Code:
day of week    0-7 (0 or 7 is Sun, or use names)

# 5  
Old 10-26-2009
Just another thing about it

Quote:
cyberview_db_2809_2009-10-23_17h30m.Friday.sql.gz
Quote:
cyberview_db_2809_2009-10-25_17h30m.Sunday.sql.gz
The above is the output (database backups) in the database folder. The time I had set is 17.30 which 5.30 p.m in the evening.

This means that the database should backup at 5.30 p.m rite?

But according to the cron.weekly output, the database will backup on Sundays at 4.22 a.m.

The backup script is already not in etc/cron.daily as before. I've already placed the script in root/bin.

So will default settings of the cron still affect the backup time? (which is Sundays at 4.22 a.m - will that still happen?)

Last edited by anaigini45; 10-26-2009 at 01:39 AM..
# 6  
Old 10-26-2009
The time you have set is 4:22 only...

22 4 * * 0 root run-parts /etc/cron.weekly

What is the confusion, the minute & hour field shows it as 4:22, you yourself could have located this ?!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

NFS Queries

Hi, I would like to know on one server how many mouting can be done? wheather there is limitation on number of mounting? wheather it is possible to increase NFS Performance? if yes then which parameters needs to given while mounting? (3 Replies)
Discussion started by: manoj.solaris
3 Replies

2. UNIX for Dummies Questions & Answers

FTP Queries

Hi, 1) How to get exact permissions, group names for files while transferring with FTP 2) Is there any command to transfer entire directory and sub directories. Thanks (1 Reply)
Discussion started by: nag_sathi
1 Replies

3. Shell Programming and Scripting

Crontab queries

Hi Expert, How to schedule a job on last day of the month. Need your kind help. Regards, PK (3 Replies)
Discussion started by: pkrabi78
3 Replies

4. UNIX for Advanced & Expert Users

How many DNS queries

Is there any way to see how many queries come into our external DNS server? In looking at DNS providers, most of them base pricing on number of queries per month so I just wanted to see if you had any idea/way of gathering that data? A rough ballpark figure would even work. Our DNS server is... (1 Reply)
Discussion started by: raggmopp
1 Replies

5. Shell Programming and Scripting

Few queries regarding awk...

One of the command output is as below. -rw-r--r--+ 1 root root 75G Nov 21 16:43 /var/ovs/mount/86BXXX/running_pool/Machine1/System-sda.img -rw-r--r--+ 1 root root 75G Nov 21 16:36 /var/ovs/mount/86BXXX/running_pool/Machine2/System.img -rw-r--r--+ 1 root root 150G Sep 23 19:13... (2 Replies)
Discussion started by: pinga123
2 Replies

6. Homework & Coursework Questions

Queries

Any help on like where to get started on this? I'm just confused. 1. The problem statement, all variables and given/known data: Enter text here.Queries to satisfy these two report requests (use your CCI database): Retrieve all rows of active inventory where current on hands is less than... (0 Replies)
Discussion started by: lakers34kb
0 Replies

7. Shell Programming and Scripting

queries about exit

hi all, please tell me clearly the difference between exit 1 and exit 2 one more question i want to know the difference between some basic shells like bsh, csh, ksh, bash. i refered in net i get wast of text pages can any one give me any link to show the diff precisely or any blogs.... (2 Replies)
Discussion started by: Arunprasad
2 Replies

8. Shell Programming and Scripting

my queries

hi guys Well, i need to have a report generation script or any script which will show me all the content/information of a file when i run that script. Please help me on this isssue at the earliest.As i am little bit aware of scripting.Thanks in advance! regards ash (4 Replies)
Discussion started by: whizkidash
4 Replies

9. UNIX for Advanced & Expert Users

Some queries...

Guys need some advice on how to check some of the questions below? i'm running on an open VMS platform... which i am an idiot to... appreciate if anyone can give some hints or source on how to check on.. a script that is running on cron job... but doesn't run as the login user name.. 1. why... (6 Replies)
Discussion started by: 12yearold
6 Replies

10. Shell Programming and Scripting

crontab settings for every 10 min eveyday?

Will this be the cron setting if I want to run the script.sh file in every 10 min eveyday? Can someone pls confirm? Thanks in advance C Saha (1 Reply)
Discussion started by: csaha
1 Replies
Login or Register to Ask a Question