script python via la crontab
Re: script python via la crontab
mon script à bien
#!/usr/bin/env python
# coding=UTF-8
par co,ntre je ne comprends pas
2 0 * * * ./py/purge.py
ca donnerait quoi dans mon cas ?
#!/usr/bin/env python
# coding=UTF-8
par co,ntre je ne comprends pas
2 0 * * * ./py/purge.py
ca donnerait quoi dans mon cas ?
-
mike913
- Messages : 159
- Inscription : 18 oct. 2014, 10:22
- Localisation : Morsang / Orge - Essonne
- Contact :
Re: script python via la crontab
Et Bien tout simplement:
il faut par contre que ton script soit exécutable
Code : Tout sélectionner
*/2 * * * * ./domoticz2/scripts/python/cozytouch.pyCode : Tout sélectionner
sudo chmod +x domoticz2/scripts/python/cozytouch.pyDS718+ 2 x 3To(SHR) - Firmware: DSM 7.0.1-42218
DS712+ 2 x 4To (SHR) - Firmware: DSM 6.2.4-25556
Raspberry - RFXTRX433 - Aeon Labs ZStick V2 - Domoticz
FreeBox Delta
https://meteo.folcke.net
https://wiki.folcke.net
DS712+ 2 x 4To (SHR) - Firmware: DSM 6.2.4-25556
Raspberry - RFXTRX433 - Aeon Labs ZStick V2 - Domoticz
FreeBox Delta
https://meteo.folcke.net
https://wiki.folcke.net
Re: script python via la crontab
ok merci mike mais ce ne fonctionne toujours pas
pour lancer le script a la main je tape:
*/1 * * * * pyhon /home/pi/domoticz2/scripts/python/cozytouch.py
pour lancer le script a la main je tape:
*/1 * * * * pyhon /home/pi/domoticz2/scripts/python/cozytouch.py
-
vil1driver
- Messages : 5661
- Inscription : 30 janv. 2015, 11:07
- Localisation : Rennes (35)
Re: script python via la crontab
Salut,
Ajoute ceci au bout de ta commande
Et regarde le fichier une fois passé le moment où ton script aurait du être exécuté
Ajoute ceci au bout de ta commande
Code : Tout sélectionner
>> /home/pi/cozytouch.log 2>&1
MAJ = VIDER LE CACHE(<-Clicable)
/!\Les mises à jour de Domoticz sont souvent sources de difficultés, ne sautez pas dessus
modules.lua
Un ex domoticzien
/!\Les mises à jour de Domoticz sont souvent sources de difficultés, ne sautez pas dessus
modules.lua
Un ex domoticzien
Re: script python via la crontab
ok j'ai mis
*/2 * * * * ./domoticz2/scripts/python/cozytouch.py >> /home/pi/cozytouch.log 2>&1
voila le retour du log
/bin/sh: 1: ./domoticz2/scripts/python/cozytouch.py: not found
pourtant le fichier cozytouch.py est bien présent
*/2 * * * * ./domoticz2/scripts/python/cozytouch.py >> /home/pi/cozytouch.log 2>&1
voila le retour du log
/bin/sh: 1: ./domoticz2/scripts/python/cozytouch.py: not found
pourtant le fichier cozytouch.py est bien présent
-
vil1driver
- Messages : 5661
- Inscription : 30 janv. 2015, 11:07
- Localisation : Rennes (35)
Re: script python via la crontab
Enlève le point en début de chemin
Cela sous entend un chemin relatif ce qui est à éviter
Met le chemin complet comme tu le faisais au départ
Cela sous entend un chemin relatif ce qui est à éviter
Met le chemin complet comme tu le faisais au départ
MAJ = VIDER LE CACHE(<-Clicable)
/!\Les mises à jour de Domoticz sont souvent sources de difficultés, ne sautez pas dessus
modules.lua
Un ex domoticzien
/!\Les mises à jour de Domoticz sont souvent sources de difficultés, ne sautez pas dessus
modules.lua
Un ex domoticzien
Re: script python via la crontab
j'ai mis
*/2 * * * * /domoticz2/scripts/python/cozytouch.py >> /home/pi/cozytouch.log 2>&1
et meme message
*/2 * * * * /home/pi/domoticz2/scripts/python/cozytouch.py >> /home/pi/cozytouch.log 2>&1
toujours le meme message d'erreur
*/2 * * * * /domoticz2/scripts/python/cozytouch.py >> /home/pi/cozytouch.log 2>&1
et meme message
*/2 * * * * /home/pi/domoticz2/scripts/python/cozytouch.py >> /home/pi/cozytouch.log 2>&1
toujours le meme message d'erreur
-
mike913
- Messages : 159
- Inscription : 18 oct. 2014, 10:22
- Localisation : Morsang / Orge - Essonne
- Contact :
Re: script python via la crontab
Si quand tu tapes ./domoticz2/scripts/python/cozytouch.py il te dis qu'il ne trouve pas le fichier c'est qu'il y a une erreur dans le chamin, est-ce que tu es sur que le répertoire de domoticz est bien domoticz2 ?
DS718+ 2 x 3To(SHR) - Firmware: DSM 7.0.1-42218
DS712+ 2 x 4To (SHR) - Firmware: DSM 6.2.4-25556
Raspberry - RFXTRX433 - Aeon Labs ZStick V2 - Domoticz
FreeBox Delta
https://meteo.folcke.net
https://wiki.folcke.net
DS712+ 2 x 4To (SHR) - Firmware: DSM 6.2.4-25556
Raspberry - RFXTRX433 - Aeon Labs ZStick V2 - Domoticz
FreeBox Delta
https://meteo.folcke.net
https://wiki.folcke.net
-
mike913
- Messages : 159
- Inscription : 18 oct. 2014, 10:22
- Localisation : Morsang / Orge - Essonne
- Contact :
Re: script python via la crontab
le point et le slash devant un nom de fichier signifie qu'il faut exécuter le script, la commande ./fichier.py signifie qu'il faut exécuter le script fichier.py qui se trouve dans le répertoire home de l'utilisateur.
j'aimerais savoir si ton script est appelé par domoticz, dans ce cas pourquoi l' appeler à l'aide du cron ?
j'aimerais savoir si ton script est appelé par domoticz, dans ce cas pourquoi l' appeler à l'aide du cron ?
DS718+ 2 x 3To(SHR) - Firmware: DSM 7.0.1-42218
DS712+ 2 x 4To (SHR) - Firmware: DSM 6.2.4-25556
Raspberry - RFXTRX433 - Aeon Labs ZStick V2 - Domoticz
FreeBox Delta
https://meteo.folcke.net
https://wiki.folcke.net
DS712+ 2 x 4To (SHR) - Firmware: DSM 6.2.4-25556
Raspberry - RFXTRX433 - Aeon Labs ZStick V2 - Domoticz
FreeBox Delta
https://meteo.folcke.net
https://wiki.folcke.net
-
mike913
- Messages : 159
- Inscription : 18 oct. 2014, 10:22
- Localisation : Morsang / Orge - Essonne
- Contact :
Re: script python via la crontab
Quand tu édites ton fichier cron avec la commande crontab -e tu es bien dans le répertoire de l'user pi, et connecté en tant que pi.
DS718+ 2 x 3To(SHR) - Firmware: DSM 7.0.1-42218
DS712+ 2 x 4To (SHR) - Firmware: DSM 6.2.4-25556
Raspberry - RFXTRX433 - Aeon Labs ZStick V2 - Domoticz
FreeBox Delta
https://meteo.folcke.net
https://wiki.folcke.net
DS712+ 2 x 4To (SHR) - Firmware: DSM 6.2.4-25556
Raspberry - RFXTRX433 - Aeon Labs ZStick V2 - Domoticz
FreeBox Delta
https://meteo.folcke.net
https://wiki.folcke.net