owner crontab

Must be cleaned all topics go to the right subforum
Post Reply
curious
Posts: 117
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

owner crontab

Post by curious » Tuesday 28 November 2017 21:56

I have problems modifying and running my crontab
The filename of my crontab-file is "pi" and can be found in the folder /var/spool/crontabs/cron

When I login in as user pi on the raspberry and modify the crontab, saving fails with the error:

Code: Select all

crontab : installing new crontab
/var/spool/cron/:mkstemp:Permission denied
crontab:edits left in /tmp/crontab.BDN3RD/crontab
when i modify the crontab file in a ssh session (winscp) it will be saved.
the owner of the file "pi" is pi
It seems that user pi when logged in with ssh is another user than user "pi" when logged into the raspberry directly.

What do I have to do to get my crontab running ?

Toulon7559
Posts: 431
Joined: Sunday 23 February 2014 18:56
Target OS: Raspberry Pi
Domoticz version: latest
Location: Hengelo(Ov)/NL
Contact:

Re: owner crontab

Post by Toulon7559 » Tuesday 28 November 2017 22:26

If I look in /var/spool/cron at my Raspberries, I see 'root' as owner for that folder.

Difference of owner causes problems:
see also this disccusion (and similar) at StackOverflow.

Name 'pi' for that file relative to owner 'pi' is confusing.
Last edited by Toulon7559 on Tuesday 28 November 2017 23:50, edited 1 time in total.
Set1 = RPI-B+RFXCom433+S0PCM+Linksprite-shield for BMP180/DS18B20/RS485+DDS238ZN1
Set2 = RPI-3+RFLinkGTW+ESP8266s+PWS_WS7000
Common = 2*PVLogger+PWS_TFA_Nexus+KAKUs
=> Energy & Data Management based on Time and on PV&Consumption&Meteo

User avatar
jannl
Posts: 937
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Geleen
Contact:

Re: owner crontab

Post by jannl » Tuesday 28 November 2017 23:13

You do not choose the name of the cron file.

curious
Posts: 117
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

Re: owner crontab

Post by curious » Wednesday 29 November 2017 21:52

I changed the owner of this crontab to root, but it still doesn't run
The name of the file was automatically given. I think it is because I created it as user pi.

@toulon7559 : I will look at the link you provided

User avatar
jannl
Posts: 937
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Geleen
Contact:

Re: owner crontab

Post by jannl » Wednesday 29 November 2017 22:07

Pi crontab is user pi and group crontab. Chmod settings are 600

How do you edit your crontab?

Besides that. I see the crontans directory has a very special bit set.

curious
Posts: 117
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

Re: owner crontab

Post by curious » Wednesday 29 November 2017 22:14

Editing is done by crontab -e
I don't know what you mean by "special bit set" , do I have to change something ?

User avatar
jannl
Posts: 937
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Geleen
Contact:

Re: owner crontab

Post by jannl » Wednesday 29 November 2017 22:32

Not sure, basically it should work after a clean install.
The /var/spool/cron/crontabs is a special directory. Which shows when you do a ls -l in /var/spool/cron

My crontab of user pi
-rw------- pi crontab pi

Toulon7559
Posts: 431
Joined: Sunday 23 February 2014 18:56
Target OS: Raspberry Pi
Domoticz version: latest
Location: Hengelo(Ov)/NL
Contact:

Re: owner crontab

Post by Toulon7559 » Thursday 30 November 2017 1:36

Looking at the output for ls -l in /var/spool/cron, agree with Janni that 'properties' are definitely not normal in that folder.

Code: Select all

[email protected]:/var/spool/cron$ ls -l
total 4
drwx-wx--T 2 root crontab 4096 Nov 24 11:11 crontabs
BTW, I use crontab -e to manage my cron
Set1 = RPI-B+RFXCom433+S0PCM+Linksprite-shield for BMP180/DS18B20/RS485+DDS238ZN1
Set2 = RPI-3+RFLinkGTW+ESP8266s+PWS_WS7000
Common = 2*PVLogger+PWS_TFA_Nexus+KAKUs
=> Energy & Data Management based on Time and on PV&Consumption&Meteo

curious
Posts: 117
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

Re: owner crontab

Post by curious » Friday 01 December 2017 11:07

@jannl : do you mean a complete reinstall of the RPi (slik)
@toulon7559 : what do you mean by 'properties' (eigenschappen in Dutch isn't ?) are definitely not normal in that folder.
There is nothing but the pi file in that folder

When I do

Code: Select all

 /var/spool/cron$ ls -l 
the message is No such file or directory
Entering the complete folder-path : same message

curious
Posts: 117
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

Re: owner crontab

Post by curious » Sunday 03 December 2017 16:08

In the passed few days I managed to get the ownership of the cron back to user pi, and I was able to edit it with the usual command crontab -e

Today I learned that a crontab will not run when one of the lines has an error.
I commented the lines in the cron file and uncommented them one by one to find out which causes the problems

Actually I still don't get it but by changing the first part from */10 * * * * to */5 * * * * I now get the expected results.

@jannl and @toulon7559 thank you for your help.

Toulon7559
Posts: 431
Joined: Sunday 23 February 2014 18:56
Target OS: Raspberry Pi
Domoticz version: latest
Location: Hengelo(Ov)/NL
Contact:

Re: owner crontab

Post by Toulon7559 » Sunday 03 December 2017 21:07

@Curious

My remark refers to seeing

Code: Select all

drwx-wx--T
A 'normal/simple' folder or file will have a property-string with rwx-combinations.
Set1 = RPI-B+RFXCom433+S0PCM+Linksprite-shield for BMP180/DS18B20/RS485+DDS238ZN1
Set2 = RPI-3+RFLinkGTW+ESP8266s+PWS_WS7000
Common = 2*PVLogger+PWS_TFA_Nexus+KAKUs
=> Energy & Data Management based on Time and on PV&Consumption&Meteo

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests