LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 11-23-2018, 10:42 PM   #1
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Can't edit crontab with vim


This is kind of a strange one that I've noticed before but haven't bothered to post until now. On Slackware64-14.2, when I do this:

Code:
EDITOR=/usr/bin/vim crontab -e
The crontab file is opened in vim as expected. However, when I make changes, save, and view the crontab again, it is apparent that the changes were not actually saved. The issue does not occur with other editors. Can anyone confirm?
 
Old 11-24-2018, 02:24 AM   #2
chris.willing
Member
 
Registered: Jun 2014
Location: Brisbane, Australia
Distribution: Slackware,LFS
Posts: 915

Rep: Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619Reputation: 619
Code:
sudo EDITOR=/usr/bin/vim crontab -e
followed by
Code:
crontab -l
shows that the edit worked OK here. I don't normally use vim so I have no special configuration set up for it - maybe that's significant (maybe not).

chris
 
Old 11-24-2018, 02:30 AM   #3
MDKDIO
Member
 
Registered: Mar 2004
Location: Sweden
Distribution: Slackware 15
Posts: 521

Rep: Reputation: 187Reputation: 187
I never use vim, but gave it a try now...
Changed the default hourly cron jobs 47 min to 45 min and saved/exit.
Reopening the file and the changes are still there...

What steps do you take to edit/save crontabs?
 
Old 11-24-2018, 06:01 AM   #4
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Original Poster
Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Quote:
Originally Posted by MDKDIO View Post
What steps do you take to edit/save crontabs?
I simply do this:

Code:
su -
EDITOR=/usr/bin/vim crontab -e
(make edits and then :wq)
crontab -l
And the changes do not show up. If I use a different editor, the changes do show up.

Last edited by montagdude; 11-24-2018 at 06:03 AM.
 
Old 11-24-2018, 06:44 AM   #5
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
Quote:
Originally Posted by montagdude View Post
This is kind of a strange one that I've noticed before but haven't bothered to post until now. On Slackware64-14.2, when I do this:

Code:
EDITOR=/usr/bin/vim crontab -e
The crontab file is opened in vim as expected. However, when I make changes, save, and view the crontab again, it is apparent that the changes were not actually saved. The issue does not occur with other editors. Can anyone confirm?
Vim has these lines in /usr/share/vim/vimrc :

Code:
" Make vim work with the 'crontab -e' command
set backupskip+=/var/spool/cron/*
It could be that you somehow have an older version of that file where the backupskip line is not present (as was the case in older versions of Slackware).
 
2 members found this post helpful.
Old 11-24-2018, 07:38 AM   #6
montagdude
Senior Member
 
Registered: Apr 2016
Distribution: Slackware
Posts: 2,011

Original Poster
Rep: Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619Reputation: 1619
Quote:
Originally Posted by Alien Bob View Post
Vim has these lines in /usr/share/vim/vimrc :

Code:
" Make vim work with the 'crontab -e' command
set backupskip+=/var/spool/cron/*
It could be that you somehow have an older version of that file where the backupskip line is not present (as was the case in older versions of Slackware).
That was it. Thanks!
 
Old 11-24-2018, 05:58 PM   #7
MDKDIO
Member
 
Registered: Mar 2004
Location: Sweden
Distribution: Slackware 15
Posts: 521

Rep: Reputation: 187Reputation: 187
Good reading you got it sorted
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can not edit cupsd.conf and can't edit properties David J Linux - Newbie 1 08-17-2018 10:57 AM
[SOLVED] Fedora shows 'man vim' but when execute 'vim' got "bash: vim: command not found..." ? flash_os Linux - Newbie 19 01-03-2015 11:56 PM
Can vim tell me the name of the editor I am running, assuming I am running vim? stf92 Linux - Desktop 5 05-28-2014 05:45 PM
Switching from vim to vim -g from inside vim iDragoon Linux - Software 4 05-15-2009 11:46 AM
Editor comparison: vim VS vim-lite, Cleaning vim Ruler2112 *BSD 4 04-13-2009 04:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration