LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 09-02-2005, 04:39 PM   #1
sarajevo
Member
 
Registered: Apr 2005
Distribution: Debian, OpenBSD,Fedora,RedHat
Posts: 228
Blog Entries: 1

Rep: Reputation: 31
Crontab sintax


Hi,
I am trying to automatize some jobs on computer and I use cron command.
For example i wrote it as follows, and I got message
crontab: installing new crontab
but at particular time nothing happened. Does anybody know what is wrong with my crontab file .....below is just example
32 23 * * * cp /home/sarajevo/sarajevo12 /home/sarajevo/sarajevo222

Thank you
 
Old 09-03-2005, 01:54 AM   #2
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
I am not sure that you can use direct commands like this in crontab. You should make a small script and place it in /etc/cron.daily. cd to cron.daily and do chmod 700 ./<script_name> and then make an entry in crontab:
32:23 * * * root /etc/cron.daily/script_name

Here is a sample of what you might like to try if you are backing up data using rsync;

#!/bin/bash
##backup files
rsync --delete-after -avH /home/sarajevo/sarajevo12 /home/sarajevo/sarajevo222 > /var/log/backup.log

What this would do is sync the directories and then delete files that no longer exist in the original directory thus keeping the 2 identical and it would send a report to /var/log/backup.log.

Hope this helps.

Last edited by TigerOC; 09-03-2005 at 02:11 AM.
 
Old 09-05-2005, 02:44 AM   #3
sarajevo
Member
 
Registered: Apr 2005
Distribution: Debian, OpenBSD,Fedora,RedHat
Posts: 228

Original Poster
Blog Entries: 1

Rep: Reputation: 31
Hi,

I wrote script


I did ( as root)
vim sarajevo1

#!/bin/bash

echo " How are you "

echo
exit 0
After I wrote
chmod 777 sarajevo1
cp sarajevo /etc/cron.daily
then cd /etc/cron.daily and ls -l showed me file sarajevo was copied there.

in crontab -e I wrote

10 10 * * * root /etc/cron.daily/sarajevo1
then
wq! + enter
and I got message
crontab: installing new crontab

but at 10 minutes after ten nothing happened, and I am wondering why. Should I adjust some other parameters in my Sarge Debian OS.
Probably this is not nothing difficult, but I can not find out what theproblem is . I just want my crontab works because it is very important for easier maintains and administrating.
Above is just simple example. I read howto's, and I think sintax in above example is ok(correct me if I am wrong)
Thank you in advance.




 
Old 09-05-2005, 05:38 AM   #4
sarajevo
Member
 
Registered: Apr 2005
Distribution: Debian, OpenBSD,Fedora,RedHat
Posts: 228

Original Poster
Blog Entries: 1

Rep: Reputation: 31
In my /var/spool/cron/crontabs is as follows

/var/spool/cron/crontabs# cat root
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.LRivMS/crontab installed on Mon Sep 5 11:29:01 2005)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
10 10 * * * root /etc/cron.daily/sarajevo1


I add text above only to fill up a jigsaw about my crontab problem
Thank you in advance

Regards
Sarajevo
 
Old 09-05-2005, 08:52 AM   #5
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
Check your /var/log/syslog and see if there is any kind of message.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
using crontab goodolday Linux - Newbie 1 04-26-2005 07:16 PM
crontab mytinytown Linux - Newbie 3 02-17-2005 07:38 AM
How to use crontab ? Dakkar Linux - Newbie 2 01-22-2004 10:49 AM
system-wide crontab in /etc/crontab ner Linux - General 2 11-18-2003 12:35 PM
Crontab Gorbachov Linux - Software 3 09-26-2003 04:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 01:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration