cancel
Showing results for 
Search instead for 
Did you mean: 

crontab -e weird behaviour

 
SOLVED
Go to solution
zxcv
Super Advisor

crontab -e weird behaviour

Hi ,

 

when am doing crontab -l m getting 5 entries.

TEST/home/fnsonlgr > crontab -l
20 10 * * * /home/fnsonlgr/.profile;/home/fnsonlgr/latest_rep.sh >/outputs/report_timing.log
30 08,11,17 * * * /home/fnsonlgr/.profile;/fns/gr/r/sh/sendcentral.sh > /outputs/sendcentralgtgb.log
00 16,18,20 * * * /fns/gr/r/cat/cfpd0903.cron > /outputs/cfpd0903cron.log
20 11,13 * * * /home/fnsonlgr/.profile;/fns/gr/r/sh/get_tb.sh >/outputs/get_gr_tb_split.log
30 11,13 * * * /home/fnsonlgr/.profile;/fns/gr/r/sh/gr_tb_split.sh >/outputs/gr_tb_split.sh.log


Whereas when m running crontab -e to edit it m displayed

 

00 16,18,20 * * * /fns/gr/r/cat/cfpd0903.cron > /outputs/cfpd0903cron.log
20 11,13 * * * /home/fnsonlgr/.profile;/fns/gr/r/sh/get_tb.sh >/outputs/get_gr_tb_split.log
30 11,13 * * * /home/fnsonlgr/.profile;/fns/gr/r/sh/gr_tb_split.sh >/outputs/gr_tb_split.sh.log

 

Wehn i scrolly my mouse up i see the two entries above it...

Is this putty display issue or cron entry issue .

 

Becausee i have another user where everything is running fine.

For the above user none of jobs are running .

 

 

3 REPLIES
Matti_Kurkela
Honored Contributor

Re: crontab -e weird behaviour

Maybe the crontab file has some non-printing characters in it?

 

Apparently "crontab -l" filters them out, but "crontab -e" passes the crontab file as-is to the editor, which attempts to display the non-printing character, causing display issues.

 

You might want to try filtering the non-printable characters out, like this:

crontab -l | cat -v - >mycrontab.txt

 Then edit the mycrontab.txt file and check it for correctness. If the "crontab -l" output contained any non-printable characters, piping it through "cat -v" should have converted them into visible symbols, like "^X" or "M-x".

 

Once the mycrontab.txt file is free of extra characters, use it to completely replace your current crontab:

crontab mycrontab.txt

 Also check your local email spool file (/var/mail/fnsonlgr): any error messages from cron are sent as local emails.

MK
Bill Hassell
Honored Contributor
Solution

Re: crontab -e weird behaviour

Are you using the console port on this server?  NEVER use the console for general sysadmin work. HP royally messed up terminal support when the GSP (now MP and iLO) first came out by refusing to pass through terminal (like PuTTY) characteristics. Instead, the console port lies to HP-UX and bypasses all the code to handle terminal screen detection.

 

That said, NEVER hardcode TERM=something or LINES= or COLUMNS= in your profile. vi will seem to mess up the display when the TERM, COLUMNS and LINES values do not match your terminal. The correct way to do this is to remove any code in your /etc/profile and .profile that has tset, and also remove any code that tests to see if TERM is already set. You must run ttytype to programatically test your terminal and set the correct values for TERM, LINES and COLUMNS, like this:

 

        eval $(ttytype -as)

 

There is one ancient bug in HP-UX for terminals like the vt100...virtually all system administrators use the backspace key, but back when the vt100 was a new product, DEC systems typically used the DELETE key, so HP's terminfo database has the vt100 (and all the vt1xx models) using the delete key rather than the backspace key. So you'll need to hardcode: export ERASE="^H";stty erase "^H" And unfortunately, PuTTY's default is also the DEL key - be sure to change that too.    

 

Once your terminal matches the terminal variables in your environment, vi should behave correctly. crontab -l (list the lines) is a simple cat of the crontab file so it will be correct. vi believes what your terminal settings are, so if they don't match, strange folding of lines and jumping cursor will be the effect.  Use ctrl-L to refresh the screen when you have terminal issues.



Bill Hassell, sysadmin
zxcv
Super Advisor

Re: crontab -e weird behaviour

Hi Bill,

You were spot on i had LINES=45 in my .profile