The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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-06-2008 03:22 AM
help with crontab bob122480 Shell Programming and Scripting 3 01-22-2007 08:49 PM
Crontab gen4ik UNIX for Dummies Questions & Answers 1 01-18-2007 07:26 AM
ftp and crontab user` Shell Programming and Scripting 27 11-13-2006 08:02 PM
Crontab lo-lp-kl UNIX for Dummies Questions & Answers 2 05-05-2005 06:21 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-26-2005
thaduka thaduka is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 28
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
  #2 (permalink)  
Old 11-26-2005
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
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.
  #3 (permalink)  
Old 11-28-2005
thaduka thaduka is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 28
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
  #4 (permalink)  
Old 12-03-2005
sudhanshu_sinha sudhanshu_sinha is offline
Registered User
  
 

Join Date: May 2005
Posts: 12
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.
  #5 (permalink)  
Old 12-04-2005
grahamb grahamb is offline
Registered User
  
 

Join Date: Dec 2005
Location: Windsor, Ont Canada
Posts: 13
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
  #6 (permalink)  
Old 12-04-2005
grahamb grahamb is offline
Registered User
  
 

Join Date: Dec 2005
Location: Windsor, Ont Canada
Posts: 13
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0