Loading ...
Sorry, an error occurred while loading the content.

'crontab -e' fails with EDITOR=vim

Expand Messages
  • qmax
    Hi. There SUBJed trouble suddenly occurs. When invoked, /usr/bin/crontab keeps temporary file opened and calls vim to edit it. lsof then shows: COMMAND PID
    Message 1 of 2 , Jan 2, 2003
    • 0 Attachment
      Hi.

      There SUBJed trouble suddenly occurs.

      When invoked, /usr/bin/crontab keeps temporary file opened and calls vim
      to edit it.

      lsof then shows:
      COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
      crontab 4536 root 5u REG 3,4 80 358366 /usr/var/tmp/crontab.XXXXYFD0PW
      vim 4537 qmax 5u REG 3,4 80 358366 /usr/var/tmp/crontab.XXXXYFD0PW

      After invoking command ':w' in vim, lsof shows:
      COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
      crontab 4536 root 5u REG 3,4 80 358366 /usr/var/tmp/crontab.XXXXYFD0PW~ (deleted)
      vim 4537 qmax 5u REG 3,4 80 358366 /usr/var/tmp/crontab.XXXXYFD0PW~ (deleted)

      /* I dunno actually what this means and what vim does with the file. */

      Then exiting from vim, crontab(1) cannot find modified file
      and fails to install new crontab, saying 'no changes made'.

      Any workaround for this strange misbehaviour ?

      --
      qMax
    • Gary Johnson
      ... Try this: set backupcopy=yes For an explanation, see :help backupcopy , especially the fifth paragraph: One situation where no and auto will cause
      Message 2 of 2 , Jan 2, 2003
      • 0 Attachment
        On 2003-01-03, qmax <qmax@...> wrote:

        > When invoked, /usr/bin/crontab keeps temporary file opened and calls vim
        > to edit it.

        > Then exiting from vim, crontab(1) cannot find modified file
        > and fails to install new crontab, saying 'no changes made'.
        >
        > Any workaround for this strange misbehaviour ?

        Try this:

        set backupcopy=yes

        For an explanation, see ":help backupcopy", especially the fifth
        paragraph:

        One situation where "no" and "auto" will cause problems: A program
        that opens a file, invokes Vim to edit that file, and then tests if
        the open file was changed (through the file descriptor) will check the
        backup file instead of the newly created file. "crontab -e" is an
        example.

        Gary

        --
        Gary Johnson | Agilent Technologies
        garyjohn@... | Spokane, Washington, USA
      Your message has been successfully submitted and would be delivered to recipients shortly.