Crontab file issue


 
Thread Tools Search this Thread
Operating Systems Solaris Crontab file issue
# 1  
Old 02-23-2013
Crontab file issue

Hi guys,

I edited my crontab file and entered this enter:
* * * * * w >> `date +%F`.who

Then I later deleted the above entry and entered :
* * * * * w >> /rpool/who/w.txt

when I login and ran : crontab -e

I get this entry:
* * * * * w >> `date +%F`.who

Instead of this entry:

* * * * * w >> /rpool/who/w.txt

i will be glad if someone can help me fix this problem.

Thank you
# 2  
Old 02-23-2013
Simple answer: never directly edit the crontab, use
Code:
crontab -e

only
Some people use vi, and it works with some versions of crond. Not all.
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 02-23-2013
Thanks Jim,

I do use
Code:
crontab -e

to edit the crontab file. But I set the default editor to vi before editing. Can that be causing the problem?

Thanks
# 4  
Old 02-23-2013
Yes, Jim is right, don't directly edit crontab files, use the tools depending on what Unix/Linux flavour you have.

The generic explanation for what you experienced is this.

When Unix boots and cron services start the crontabs are read into memory and the last modified date/time of each crontab is also loaded into memory. Periodically, the cron service wakes up and goes to see if any crontabs on disk have been modified since boot time. If it finds a modified crontab, then it loads it into memory overwriting the old one.

Therefore, you can see that until this periodic check runs (and it varies according to Unix version), your modifications won't be seen.

However, if you use the proper tools then cron knows about it straight away.

Alternatively, if you modify crontabs directly, stop, then start the cron service from the command line (see man pages for this according to your Unix version).

Hope that helps.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Another issue with crontab

My shell script it.sh #!/bin/sh ORACLE_HOME=/var/opt/oracle/product/10g; export ORACLE_HOME PATH=$PATH:$ORACLE_HOME/bin:/bin:/usr/bin; export PATH today=`date "+%m-%d-%Y %H:%M:%S"`; export today CUR_DIR=$1; export CUR_DIR LOG_FILE=$CUR_DIR/error.log; export LOG_FILE # Direct... (30 Replies)
Discussion started by: rafa_fed2
30 Replies

2. UNIX for Dummies Questions & Answers

Crontab issue

Hello, I have a bash script that finds files older than 31 days and deletes them. I have this file loading into crontab to run everyday. It ran fine the first time i loaded it in, but now when I try to run it manually (bash file.sh) I get errors. Here is the script TIME=" -maxdepth 1... (6 Replies)
Discussion started by: jrymer
6 Replies

3. UNIX for Advanced & Expert Users

Crontab Issue

My colleague who was a sysadmin , has created a cron job script which collects logs and process them. The script works perfectly as per the defined time set by him. it works when we keep the timing as 55 05 * * * , whereas if we try to prepone the cron task is not getting executed. Where... (10 Replies)
Discussion started by: aravindj80
10 Replies

4. UNIX for Dummies Questions & Answers

Crontab Issue..!!!

Hi, I have a cronjob but it is not getting executed.Is there any ways to check whether crontab is working.I have put crontab -l and checked.It got listed.But it is not working. My Crontab is, * * * * * /ldesk/home/abc/source/compare.sh >/dev/null 2>&1 (1 Reply)
Discussion started by: gayisada
1 Replies

5. AIX

Crontab issue

Hi all, I'm having a problem with a crontab entry execution for a non root user. AIX version 5.3 user@host ~ $ oslevel -r 5300-10 cron status user@host ~ $ ps -ef | grep cron root 377044 1 0 Oct 27 - 0:22 /usr/sbin/cron cron entry for user user@host ~ $... (3 Replies)
Discussion started by: h@foorsa.biz
3 Replies

6. UNIX for Advanced & Expert Users

Crontab issue

We have configured a script to be run at specific time using crontab. # crontab -l 15 11 * * * VM_Count_V4.shas per the crontab entry script should run every day 11.15 a.m Every time when the script is executed i get a mail but when i run it using crontab it doesn't send any mail. However... (1 Reply)
Discussion started by: pinga123
1 Replies

7. Shell Programming and Scripting

Issue with crontab

I have a ksh script which will connect to a database and executes some sql scripts. If i run the ksh script it is working fine. But if i schedule it to run at a perticular time using cron the sql script is not running. The scriptl initially creates a spool file for sql script and then connects and... (12 Replies)
Discussion started by: Sriranga
12 Replies

8. Shell Programming and Scripting

crontab issue

Helo . I have 2.6.13-1.1526_FC4smp here. I am trying to make crontab execute my simple shell script, but noting happens. here is how i am testing this : $ pwd /home/oracle $ ls -l two* ls: two*: No such file or directory $ $ crontab -e crontab: installing new crontab $ $ crontab... (7 Replies)
Discussion started by: tonijel
7 Replies

9. UNIX for Advanced & Expert Users

crontab issue

I am adding a piece of code which adds entry in crontab ((in brown color)) \crontab -l > $tmpfile echo "Removing the cleanProcess entry if it already existed.." grep -v "cleanProcess.sh" $tmpfile > $newtmpfile lcnt=`grep -c "cleanProcess.sh" $tmpfile` echo... (4 Replies)
Discussion started by: crackthehit007
4 Replies

10. Solaris

crontab issue

Can someone help with a cron issue on a Sun Solaris 9 machine? The problem I am having is that one of my cron jobs is sending output to the /var/mail/root and I am trying to get it to stop. I have other cron jobs that are running that do not place any output to that location. They do however send... (6 Replies)
Discussion started by: Semper_Tempus
6 Replies
Login or Register to Ask a Question