two out of four crontab jobs don't run

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

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

two out of four crontab jobs don't run

Post by curious »

I check the presence of four phones every ten minutes.
This are the lines in my crontab

Code: Select all

name1 phone
*/10 * * * * /home/pi/domoticz/scripts/check_device_online.py 10.0.0.13 461 10 120
#name2 phone
*/10 * * * * /home/pi/domoticz/scripts/check_device_online.py 10.0.0.6 462 10 120
#name3 phone
*/10 * * * * /home/pi/domoticz/scripts/check_device_online.py 10.0.0.18 455 10 120
#name4 phone
*/10 * * * * /home/pi/domoticz/scripts/check_device_online.py 10.0.0.24 463 10 120
What's odd: for ip ...6 and ...18 a new pid is created for ...13 and 24 no new files are created.
When I run the lines manually I do get a new file

Some one any idea why this can happen ?
By the way : The new created pid have no content. Is that correct ?
Dunkan
Posts: 4
Joined: Friday 20 December 2013 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.5877
Location: Edinburgh, Scotland

Re: two out of four crontab jobs don't run

Post by Dunkan »

I've just implemented this program to check for the presence of 4 phones in the house. The program loops within itself (which is what the 3rd arg is for). The crontab entries are to ensure it's restarted in case it stops for any reason. Within the program you can specify whether you want to use pid (recommended) or ps to check for tasks already running for the specified IP address. Rebooting the PC is a clean way to restart everything, or use the following to check for running tasks and kill them

Code: Select all

ps aux | grep check
I've altered the code to use both ping & arping as either by themselves was oddly not reliable for my LAN. I've also added logging, so I can tail the log file to see what's happening.

the pid file is just an empty file to show that the process is working, I think in theory is should hold the pid number which would allow you to see which task to kill if you wanted to restart the task.

To check the program you should comment out your 4 cron entries, and reboot. remove any pid files, then open 4 terminals and run the 4 tasks. You don't say what h/w or OS you are using.
curious
Posts: 132
Joined: Saturday 02 April 2016 19:38
Target OS: -
Domoticz version:
Contact:

Re: two out of four crontab jobs don't run

Post by curious »

I am running Domoticz on a Raspberry 2

When I run the 4 cron entries manually they work fine and I get 4 pid's.

When I try to change the cron with crontab -e next message appears after saving:

Code: Select all

crontab : installing new crontab
/var/spool/cron/:mkstemp:Permission denied 
crontab: edits left in /tmp/crontab.zFBpOK/crontab
So it looks like changes are saved in a temporary folder.
So I changed /var/spool/cron/pi with an editor. But they still don't run

Top of the edited file has the following lines :

Code: Select all

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.eaYF7K/crontab installed on Sat Jun 24 14:50:26 2017)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
# Edit this file to introduce tasks to be run by cron.
So: how do I edit the master and reinstall it ?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest