The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
crontab couldn't run through, help duke0001 UNIX for Advanced & Expert Users 10 02-05-2008 11:22 PM
help with crontab bob122480 Shell Programming and Scripting 3 01-22-2007 04:49 PM
Crontab gen4ik UNIX for Dummies Questions & Answers 1 01-18-2007 03:26 AM
ftp and crontab user` Shell Programming and Scripting 27 11-13-2006 04:02 PM
Crontab lo-lp-kl UNIX for Dummies Questions & Answers 2 05-05-2005 03:21 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-26-2005
Registered User
 

Join Date: Aug 2005
Posts: 28
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
crontab help

Hi All,
Please help me in understanding the crontab entries and also below queries

1. how can we set a crontab entry
2. from where the cronjob will run( if default)
3. you can we specify the location from which the cronjob should run.
4. how can we capture the output of the cronjob.

Thanks
Satish
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 11-26-2005
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,313
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
To begin with, read the man pages of cron and crontab (both crontab(1) and crontab(5)). This probably will answer most of your questions.
Reply With Quote
  #3 (permalink)  
Old 11-28-2005
Registered User
 

Join Date: Aug 2005
Posts: 28
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
please help me for this 2 questions

1 from where the cronjob will run( if default)
2. Can we specify the location from which the cronjob should run.


Thanks
satish
Reply With Quote
  #4 (permalink)  
Old 12-03-2005
Junior Member
 

Join Date: May 2005
Posts: 12
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
crontab -issue

crontab if not specified will run fron root users account ,location as in which program u want to run or what please be more clear,the man pages will be good place to start with and also you can capture the output of crontab by redirecting the output to some file instead of /dev/null.
Reply With Quote
  #5 (permalink)  
Old 12-04-2005
Registered User
 

Join Date: Dec 2005
Location: Windsor, Ont Canada
Posts: 12
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Creating crontab! files! Who runs crontab?

Hi

If you want a specific user to run a crontab (root, myself, yourself, etc) then the easy way is to log into that users account and create the crontab entry:
"crontab -e"
This gives you YOUR OWN (or that users) crontab file to edit, using say "vi", or "gvim, whatever is the default editor.

Save and exit the changes with:
":wq" from inside the text editor.

Use "crontab -l" to view the YOUR OWN (or that users) crontab contents - without the risk of editing it.

Bye
GrahamB
Reply With Quote
  #6 (permalink)  
Old 12-04-2005
Registered User
 

Join Date: Dec 2005
Location: Windsor, Ont Canada
Posts: 12
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Output from crontab

Hi Satish:

Your last question: how can we capture the output of the cronjob.

Use the directional parameters "> $file" and/or ">> $file" for example. Anything that goes to stdout would then be routed to $file. Any other stdoutput would, for example go into the mail of the user who has called the crontab-job.

Try something like this:
Code:
10 4 * * * . ~/.bashrc; ${SCRIPTS}/backup_mysql.sh >> ${BACKUPS_LOG}/${HOSTNAME}_mysql_v${VERS}.script.log 2>&1
My practice is to get output from the specific functions in the program to output to log files. For example the program "./backup_mysql.sh" may generate files that are of interest to specific users.

Above the redirection is to a log-file describing the overall performance of the program and the variable used by "./backup_mysql.sh". This logs data that would be of interest to the administrator, for example.

Note: "2>&1" is also a redirection. Another story!

regards
GrahamB
Reply With Quote
  #7 (permalink)  
Old 12-09-2005
Registered User
 

Join Date: Aug 2005
Posts: 28
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Hi grahamb,

Thanks for your info. 1 more quick questions as you said the below

"2>&1" is also a redirection. Another story!


can you please explain this concept also. it will very helpful .


Thanks
Satish
Reply With Quote
  #8 (permalink)  
Old 12-10-2005
Junior Member
 

Join Date: May 2005
Posts: 12
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
crontab -issue

Hi

the 2 >&1 represent standard error that is represented as 2 should also be redirected where the standard ouput has been directed it is a posix notation and can be found in man sh posix
hope this will clear your doubt.
Goodluck
Reply With Quote
  #9 (permalink)  
Old 12-10-2005
Registered User
 

Join Date: Aug 2005
Posts: 28
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Got the info and cleared my doubt
Thanks for all of you ,


Thanks
satish
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes


The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
421 service not available, remote server has closed connection ^m automate ftp autosys awk trim bash eval bash exec bash for loop close_wait command copy/move folder in unix couldn't set locale correctly curses.h cut command in unix dead.letter find grep find null character in a unix file grep multiple lines grep or grep recursive inaddr_any inappropriate ioctl for device ksh if logrotate.conf lynx javascript mailx attachment mget mtime ping port remove first character from string in k shell replace space by comma , perl script scp recursive segmentation fault(coredump) sftp script snoop unix stale nfs file handle syn_sent tar exclude test: argument expected unix unix .profile unix forum unix forums unix internals unix interview questions unix mtime unix simulator unix.com vi substitute vi+substitute+end+of+line+character while loop within while loop shell script


All times are GMT -7. The time now is 07:19 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101