Linux / UNIX Tech Support Forum
This is a discussion on Diff b/w /etc/crontab and /usr/bin/crontab within the Shell scripting forums, part of the Development/Scripting category; Hi, I want to know which crontab firl i should edit to schedule my script running and whats the difference ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi,
I want to know which crontab firl i should edit to schedule my script running and whats the difference between processing of /etc/crontab and /usr/bin/crontab? Thanks |
| Sponsored Links | ||
|
|
|
||||
|
/etc/crontab - Configration file for cron job
/usr/bin/crontab - Binary program to edit user crontab installed in /var/spool/cron file Basically, you need to use crontab command itself to install or edit other users job. To edit root user job: Code:
crontab -e -u root Code:
crontab -e -u tom How do I add jobs to cron under Linux or UNIX oses?
__________________
Vivek Gite Linux Evangelist |
|
|||
|
thanks for reply,
But still m not able to run my script through cron,I have done following things: crontab -e root 26 21 * * * /hello.sh This is my hello.sh file: echo "test completed" echo "congratulations" mkdir gullu where will it display the message and also no directory is made. I also tried( * * * * * date >> /tmp/dates.txt) and this is done correctly. Then whats wrong with my script and also do i need to write "./script" or simply "/script" to run the script? early reply wud be appreciated Thenks |
|
||||
|
You need to specify full path for hello.sh. For e.g. if hello.sh is in /root, enter:
Code:
26 21 * * * /root/hello.sh Code:
chmod +x /root/hello.sh Code:
Shell scripting: Write message to a syslog / log file
__________________
Vivek Gite Linux Evangelist |
|
|||
|
thanks,my script got ececuted
Also i wasnt able to open the link provided by u due to office policies and cudnt get any good information from elsewhere. Pls tell me the how to use logger command to generate output to the console or log file. Also i want to know that if my script simply prints "hello" on console,when i try to schedule it with cron,what will happen to the output,where does the output goes?i cant see anything on console. Thanks in advance for your help. |
|
||||
|
Code:
logger "This is a test" tail -f /var/log/messages
__________________
Vivek Gite Linux Evangelist |
|
|||
|
thanks fo rthe reply
So i can place any output from shell script through crontab in log file,that means i can not print output to console through crontab? Like my script only prints text on console,if i run that script through crontab then what will happen to that output? |
![]() |
| Tags |
| cron , cronjobs , crontab , linux , unix |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Crontab question | edb75 | Linux software | 3 | 24-07-2008 03:39 PM |
| crontab | click007 | Getting started tutorials | 6 | 19-10-2007 04:45 PM |
| Crontab | lacloai | Linux software | 2 | 01-06-2007 03:44 AM |
| about crontab | darknet | Shell scripting | 2 | 04-01-2007 06:01 PM |
| list every user's crontab script | marinm | Shell scripting | 5 | 19-07-2005 11:24 PM |