Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

75%
+4 −0
Q&A VISUAL=gvim makes crontab -e open a new crontab instead of a current one

My VISUAL setup interferes with my cron jobs. crontab -l works all right, I see my previous jobs. crontab -e, crontab -e -u user-here - opens GVIM on an empty file checked cron.allow or .deny,...

1 answer  ·  posted 6mo ago by LAFK‭  ·  last activity 6mo ago by Quasímodo‭

Question cron
#1: Initial revision by user avatar LAFK‭ · 2023-11-12T07:49:43Z (6 months ago)
VISUAL=gvim makes crontab -e open a new crontab instead of a current one
My VISUAL setup interferes with my cron jobs. 

 1. `crontab -l` works all right, I see my previous jobs.
 2. `crontab -e`, `crontab -e -u user-here` - opens GVIM on an empty file
 3. checked cron.allow or .deny, nothing, did add cron.allow with my user, nothing changed
 4. 1 and 2 are even AFTER I've added my user to `crontab` group - `sudo usermod -aG crontab user-here`. This made it see the `/var/spool/cron/crontabs` dir (but not the user crontab file inside?). 
 5. `sudo crontab -e -u user-here` - opens Vim on my desired file **that's the workaround fellas, not a fix, but gets the job done**
 6. `vim /var/spool/cron/crontabs/your-user-here` works and opens the file as expected, allows edition, but then you have to `kill -1 your-cron-demon-here`, or sent the SIGHUP another way, so cron process knows to re-check config files. A much worse workaround.

So, now I know it's the editor setup. Cron looks at two variables `VISUAL` and `EDITOR`, so I checked my configs and sure, I had VISUAL set (`VISUAL=gvim`). I've reset it, opened a new terminal and nothing.

## Works as I want crontab -e to work

1. `sudo crontab -e -u your-user-here`
2. `VISUAL=""; crontab -e`

How to "fix" visual editor so it opens my crontab, and not an empty one?