[CentOS] Crontab not working....

Mon Sep 25 14:27:51 UTC 2006
Will McDonald <wmcdonald at gmail.com>

On 25/09/06, Ian mu <mu.llamas at gmail.com> wrote:
> Hiya, thanks a lot for that Will (sorry spelt name wrong before!), think
> you're reply has almost got there...
>
> If I dos2unix the file it works, if I use vi/m (what I normally use) or nano
> etc, it doesn't work (but will if I then dos2unix it again)?
>
> SELinux I think is on permissive/targeted (I'm not too familiar with selinux
> as someone else set it up, but my understanding is that it should allow all,
> but log/audit it?).
>
> Looks like thats it, but not sure still why its not saving it correctly?

Sounds like vi/vim's doing something weird to the file on write/save.
Have you any user specific initialisation in the user whose crontab
you're editing's $HOME? i.e. If you're setting up the crontab for
logadmin, whilst logged in *as* logadmin, is there a $HOME/.vimrc file
or similar?

If you just run vi/vim without passing it any files to edit then do

:set

... what does that result it? On a vanilla system here with
vim-enhanced installed and no customisations, running vi I get...

:set
--- Options ---
  backspace=2         history=50          ttyfast             t_Sf=^[[3%dm
  cscopetag           hlsearch            ttymouse=xterm
  cscopeverbose       ruler               viminfo='20,"50
  helplang=en         scroll=11           t_Sb=^[[4%dm
  cscopeprg=/usr/bin/cscope
  fileencodings=utf-8,latin1
Hit ENTER or type command to continue

Compare that to what you get by default and what you get when you run
crontab -e. If I run crontab -e then examine vi's environment it's
just...

:set
--- Options ---
  backspace=2         history=50          scroll=11           ttyfast
  fileencoding=utf-8
  fileencodings=ucs-bom,utf-8,latin1
Hit ENTER or type command to continue


Will.