Page 1 of 1

Crontab issues on Raspberry Pi 4 with Buster

Posted: Tue Jul 16, 2019 10:00 am
by Vaakkux
Hi there

I've been working on a personal project that involves making changes to the crontab.
In stretch I am able to edit the crontab as pi user (crontab -e) and successfully enable a file to run on startup, I am also able to do the same as root user (sudo crontab -e) for the same file.

However, I am currently unable to edit the crontab as pi user in Buster. As root user, I can successfully edit the crontab. but the pi user crontab doesn't appear to allow for editing.

Any help is appreciated.

Re: Crontab issues on Raspberry Pi 4 with Buster

Posted: Tue Jul 16, 2019 10:28 am
by pcmanbob
Seems to work just fine on my pi4B running buster lite.

added this line to pi user cron using crontab -e

Code: Select all

1-59/2 * * * * date >> /home/pi/test.txt 2>&1
produces a text file in /home/pi as expected containing the output of the date command

Code: Select all

Tue 16 Jul 11:25:01 BST 2019
Tue 16 Jul 11:27:01 BST 2019
Edit
same test on buster with full desktop works exactly the same, accessed via ssh.

So what changes have you made to your pi OS that might have affected this ?

might also help if you show us a screen shot of any error messages or your crontab not working.

Re: Crontab issues on Raspberry Pi 4 with Buster

Posted: Tue Jul 16, 2019 10:51 am
by RaTTuS
^WHS
crontab -e
sudo crontab -e
crontab -l
sudo crontab -l
all works as expected

[raspbian lite]

Re: Crontab issues on Raspberry Pi 4 with Buster

Posted: Tue Jul 16, 2019 2:18 pm
by SimonBlake
I thought I was suffering this problem too - the editor never seemed to completely load the cron file.

But it does - it's simply that the ordering of the list of potential editors has changed. Previously, selecting option 2 gave you nano, but now option 1 gives you nano, and option 2 is vim.tiny. If you're used to nano and you try vim, it (not surprisingly) behaves differently.

To select your favourite editor again, simply run select-editor to choose again.

Simon

Re: Crontab issues on Raspberry Pi 4 with Buster

Posted: Tue Jul 16, 2019 3:02 pm
by Vaakkux
SimonBlake wrote:
Tue Jul 16, 2019 2:18 pm
I thought I was suffering this problem too - the editor never seemed to completely load the cron file.

But it does - it's simply that the ordering of the list of potential editors has changed. Previously, selecting option 2 gave you nano, but now option 1 gives you nano, and option 2 is vim.tiny. If you're used to nano and you try vim, it (not surprisingly) behaves differently.

To select your favorite editor again, simply run select-editor to choose again.

Simon
Hi Simon,

I'm using the Vim editor to make the change I need, which appears to be its default.

After making the change I attempt to exit, as you would in the nano editor, however it then comes up with ' press qa:! to exit and delete all the changes. I'm not very experienced using Vim so is there a cmd to exist it and save the changes not remove them?

Re: Crontab issues on Raspberry Pi 4 with Buster

Posted: Tue Jul 16, 2019 3:06 pm
by RaTTuS
esc:wq

means write and quit

qa:!

means quit all : ignore changes

Re: Crontab issues on Raspberry Pi 4 with Buster

Posted: Tue Jul 16, 2019 3:50 pm
by Vaakkux
RaTTuS wrote:
Tue Jul 16, 2019 3:06 pm
esc:wq

means write and quit

qa:!

means quit all : ignore changes
It's worked, thank you for your help.

Re: Crontab issues on Raspberry Pi 4 with Buster

Posted: Tue Jul 16, 2019 8:36 pm
by DougieLawson
If you use EDITOR=nano crontab -e it will switch to nano. There's also select-editor which allows you to choose your preferred EDITOR variable setting.