SOLVED---Crontab question

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

SOLVED---Crontab question

Postby leon244 » Nov 14th, '24, 17:34

I reistalled Mageia 9 a few months ago and have been reinstalling my apps. I use luckybackup for doing backups and all has been going well.
I have kernel 6.6.58 installed.
In my prior set up I would set jobs for luckybackup and have luckybackup write to crontab. After that I could simply do a 'crontab -e' and see and edit the crontab file, for example to have it backup twice a month.
Now I was able to set up luckybackup as before and have it write the crontab file, however when I tried to edit it via crontab -e I got an empty file.
I searched for the file and found it under /var/spool/cron/lgoldman. The only way to edit it would be to open an administrator Konsole and then open Kate via that console and then get to the file. Otherwise I cannot open the file.
Is this expected behavior?
Just curious.
Thanks
Leon
Last edited by leon244 on Nov 15th, '24, 23:18, edited 2 times in total.
leon244
 
Posts: 127
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: Crontab question

Postby doktor5000 » Nov 14th, '24, 20:03

Did you run luckybackup as your user or as root when it wrote the crontab entry initially ?
Per default it should use the current users crontab as per https://luckybackup.sourceforge.net/man ... rontabInfo
Also the files under /var/spool/cron are not mean to be edited directly, but you should get the same content what's in there when you run crontab -e as your user.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18041
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Crontab question

Postby leon244 » Nov 14th, '24, 20:40

I set luckybackup as user not root. I also did not edit the file, just wanted to find it
leon244
 
Posts: 127
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: Crontab question

Postby leon244 » Nov 14th, '24, 21:27

FWIW doing as user
Code: Select all
crontab -e
opens a empty file with nothing in it
Doing
Code: Select all
sudo crontab -u $User -e
opens my crontab
In addition
Code: Select all
crontab -l
opens the appropriate file
leon244
 
Posts: 127
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: Crontab question

Postby doktor5000 » Nov 14th, '24, 23:32

leon244 wrote:Doing
Code: Select all
sudo crontab -u $User -e
opens my crontab

It opens it as root. So if you ran sudo luckybackup and set the crontab that way no wonder your regular user does not have permissions to edit it.

crontab -l only lists the content which only needs read access.

Please don't forget to mark the thread as solved, by editing the subject of the first post and prefix it with [SOLVED], thanks in advance.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18041
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Crontab question

Postby leon244 » Nov 14th, '24, 23:41

I set up Luckybackup as user not as root. I created the cron within luckybackup as the User not root.. Unless luckybackup creates the user's cron as root, but I don't see how. I am still confused.. When I open LB as the user all the appropriate profiles are there. If I open it as root and the heading says "Super User mode" there are none of the profiles present. This is why I am confused, I did everything as the user not root. For me this issue is not solved. Sorry
leon244
 
Posts: 127
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: Crontab question

Postby doktor5000 » Nov 15th, '24, 00:32

If you did all this as user, why did you try
Code: Select all
sudo crontab -u $User -e

while sudo is not even configured by default ?

The crontab command is setuid by default, and your user is not allowed to the generated crontabs under /var/spool/cron/
The crontab command will generate a temporary file and later write this to /var/spool/cron/- that is why you cannot open that file directly.

You may need to check if your user is listed in /etc/cron.allow if that exists and add your user in there.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18041
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Crontab question

Postby leon244 » Nov 15th, '24, 00:48

I tried the -u out of curiosity when -e did not work for me. There is no cron.allow file. I did try to create it and put myself I it but no change. I have written to luckybackup to see what they say. I will also try removing the crontab file and recreate it. But that’s for tomorrow
leon244
 
Posts: 127
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: Crontab question

Postby leon244 » Nov 15th, '24, 18:53

crontab -e appears to be the problem.
crontab -e opens an editor, but the Konsole shows
Code: Select all
[user is lgoldman]$>crontab -e
crontab: no changes made to crontab
and reverts to the command line even though the editor is open
So this time I did 'crontab -e', wrote a line in the editor and saved the file.
When I did crontab -e a second time I got an empty file and the line I had previously added was no where to be found.
I don't know what is happening but LB is working and I will just use it for my backup cron jobs.
I will mark the thread as "Resolved" as I am done with it but the problem is not Solved
leon244
 
Posts: 127
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: Crontab question

Postby doktor5000 » Nov 15th, '24, 19:48

leon244 wrote:crontab -e opens an editor, but the Konsole shows
Code: Select all
[user is lgoldman]$>crontab -e
crontab: no changes made to crontab
and reverts to the command line even though the editor is open
So this time I did 'crontab -e', wrote a line in the editor and saved the file.

crontab -e opens your crontab in what is defined as your editor by the environment variable $EDITOR or $VISUAL
You edit that file in the editor, save it and quit the editor, the resulting file is read by crontab.

Try using a different editor like vim or nano like this:

Code: Select all
EDITOR=vim crontab -e
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18041
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: RESOLVED---Crontab question

Postby leon244 » Nov 15th, '24, 21:09

I’ll try but originally before setting Kate as my editor it was vi and the same thing was happening
leon244
 
Posts: 127
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: SOLVED---Crontab question

Postby leon244 » Nov 15th, '24, 23:24

Doktor, thank you for you perseverence and patience.
Try using a different editor like vim or nano like this:

Code: Select all
EDITOR=vim crontab -e

The short answer is nano or vi work. Kate does not, nor does sublime_text
I tried your code and would point out that the addition of 'crontab -e' at the end made my system unbootable until I went into recovery mode and edited the line out.
I then booted and made nano my editor and it worked as it should .
I then repeated and changed back to Kate and it failed.
I then tried sublime_text and it failed
As it stands it appears that vi, vim, or nano need to be the editor. I have not tried any other editors.
I'm tired and done
Again thank you for your patience and kindness
Leon
leon244
 
Posts: 127
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: SOLVED---Crontab question

Postby doktor5000 » Nov 16th, '24, 01:29

leon244 wrote:I tried your code and would point out that the addition of 'crontab -e' at the end made my system unbootable until I went into recovery mode and edited the line out.

Edit what line out?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18041
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: SOLVED---Crontab question

Postby leon244 » Nov 16th, '24, 01:46

doktor5000 wrote:Edit what line out?

Had to remove ‘ crontab -e’ from the line and just use ‘EDITOR=vim’
The finally settled on
Code: Select all
EDITOR=nano
leon244
 
Posts: 127
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: SOLVED---Crontab question

Postby doktor5000 » Nov 16th, '24, 18:39

But where did you put that line that you would end up in recovery mode ?
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18041
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: SOLVED---Crontab question

Postby leon244 » Nov 16th, '24, 19:19

Here is what happened.
I put your suggestion
Code: Select all
EDITOR=vim crontab -e
into my .bash_profile replacing the existing EDITOR line
I then rebooted my computer
I got to the login screen, entered my credentials and it began logging in, but immediately hung up and became unresponsive.
I had to manually shut the system down and restart it. At the grub screen I chose the advanced option and then chose to boot into recovery mode for my kernel
In recovery mode I entered as root and the from the command line opened nano and chose my .bash_profile to edit and removed
Code: Select all
crontab -e
from the
Code: Select all
EDITOR=
line and then rebooted. After that the system booted wiithout a problem.
From that point I kept changing the text editor in the "EDITOR=" line and kept logging in and out to see what would work, Nano worked . After my last reply I tried gedit and that works too.
I hope this clarifies events for you
leon244
 
Posts: 127
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: SOLVED---Crontab question

Postby doktor5000 » Nov 17th, '24, 18:44

leon244 wrote:Here is what happened.
I put your suggestion
Code: Select all
EDITOR=vim crontab -e
into my .bash_profile replacing the existing EDITOR line
I then rebooted my computer

crontab -e is an interactive command, why would you put that inside your .bash_rc ?
EDITOR=vim would be sufficient to change the editor.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18041
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: SOLVED---Crontab question

Postby leon244 » Nov 17th, '24, 19:10

I just exactly copied the line you had written. I thought it was strange but deferred to you. See your reply to me with the code you suggested
leon244
 
Posts: 127
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: SOLVED---Crontab question

Postby doktor5000 » Nov 17th, '24, 20:31

I've never mentioned that you should put that in your .bash_rc, you could have simply asked about that.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18041
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: SOLVED---Crontab question

Postby leon244 » Nov 17th, '24, 20:48

doktor5000 wrote:
Try using a different editor like vim or nano like this:

Code: Select all
EDITOR=vim crontab -e

This is what you wrote. That all I am saying. No big deal I erred
leon244
 
Posts: 127
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA

Re: SOLVED---Crontab question

Postby doktor5000 » Nov 17th, '24, 22:49

Yeah, that's the command to edit your crontab with a different editor. Nowhere does it say "please put this in your .bash_rc".
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18041
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: SOLVED---Crontab question

Postby leon244 » Nov 18th, '24, 00:43

We are going in circles. Let’s just leave it. I made an error.
leon244
 
Posts: 127
Joined: Jun 4th, '11, 19:41
Location: Massachusetts, USA


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest