stickneyar
Posts: 4
Joined: Tue Jun 06, 2017 9:42 pm

crontab -e will not edit crontab but crontab -l will list it? - pi Jesse

Wed Sep 27, 2017 8:37 pm

I have tried to edit the crontab file to run a program at reboot,

when I enter sudo crontab -e it indicates no file exists for pi

when I enter sudo -E crontab -e I get the file I previously edited using sudo nano crontab -e and it is correct, but when I go to save it ctr-X it saves it to /tmp/crontab.xxxxx/crontab where xxxxx is different every time.

If I go to /tmp directory no crontab.xxxx file or directory exist.

I have changed the save directory to /tmp/crontab many times and when I exit no change is made.

If I enter sudo crontab -l it displays my file perfectly.

Any ideas
Ray

pcmanbob
Posts: 7285
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: crontab -e will not edit crontab but crontab -l will list it? - pi Jesse

Wed Sep 27, 2017 9:40 pm

Buy using sudo crontab -e you are editing roots Cron file.
If you want to edit pi's Cron file the use crontab -e

crontab always saves to a temp file first once it checks the file for sanity it installs in the Cron file.
It normally repots this as installing new Cron file
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
DougieLawson
Posts: 36575
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: crontab -e will not edit crontab but crontab -l will list it? - pi Jesse

Wed Sep 27, 2017 9:53 pm

Stop using sudo.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Martin Frezman
Posts: 1020
Joined: Mon Oct 31, 2016 10:05 am

Re: crontab -e will not edit crontab but crontab -l will list it? - pi Jesse

Wed Sep 27, 2017 10:00 pm

And, for that matter, stop using crontab.

cron (and crontab) has all sorts of traps that catch up the unwary. Unless you really have a reason to use this bit of 70s/80s technology (or if, like many of us, you grew up on cron/crontab and you really, thoroughly, understand it), you're better off just skipping it.

Other, more modern methods exist. Probably the most straightforward is to setup a "systemd" service.

Note that I said "most straightforward"; I didn't say "the best".
If this post appears in the wrong forums category, my apologies.

Return to “Troubleshooting”