Page 1 sur 4

Crontab problème lancement scripts

Posté : sam. 13 oct. 2018 16:07
par loutch
Hello

Voila je voudrais lancer un script avec crontab toute les heures mais le script ne se lance pas .Le script fonctionne en le lançant @ la mano

Code : Tout sélectionner

crontab -l
# Edit this file to introduce tasks to be run by cron.
# 
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
# 
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').# 
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# 
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# 
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# 
# For more information see the manual pages of crontab(5) and cron(8)
# 
# m h  dom mon dow   command



0 * * * * bash /home/loutch/Images/hourWallpapers.sh
Voila mauvaise configuration du crontab ,

merci pour toutes vos lumières

@+

Re: Crontab problème lancement scripts

Posté : sam. 13 oct. 2018 22:31
par arghlub
Salut,

pour t'aider dans la config de cron, tu pourrais utiliser un outil en ligne si tu n'es pas à l'aise à la mano : ;)

Re: Crontab problème lancement scripts

Posté : sam. 13 oct. 2018 22:41
par arghlub
Tu veux lancer ton script avec quelle fréquence ????
De plus, dans ta commande : entoure "bash /home/loutch/Images/hourWallpapers.sh" de guillemets ;)

Re: Crontab problème lancement scripts

Posté : lun. 15 oct. 2018 09:22
par loutch
hello

arghlub a écrit :Tu veux lancer ton script avec quelle fréquence ????
De plus, dans ta commande : entoure "bash /home/loutch/Images/hourWallpapers.sh" de guillemets ;)

je voudrais le lancer toutes les heures

cronmaker avec

Code : Tout sélectionner

0 * * * * bash /home/loutch/Images/hourWallpapers.sh
me donne ceci

Code : Tout sélectionner

Your cron expression is invalid !
crontab generator me donne ceci

Code : Tout sélectionner

* * * * * bash /home/loutch/hourWallpapers.sh >/dev/null 2>&1 >/dev/null 2>&1

Il ni aurais pas une histoire de permissions parce que j'ai ceci dans /var/spool/cron

Image

crontabs doit etre ouvert en root

Image

Code : Tout sélectionner

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.A1Vzej/crontab installed on Mon Oct 15 09:08:07 2018)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
0 * * * * bash /home/loutch/hourWallpapers.sh >/dev/null 2>&1
qui correspond

Code : Tout sélectionner

crontab -l
0 * * * * bash /home/loutch/hourWallpapers.sh >/dev/null 2>&1
donc est-ce que l'utilisateur loutch est autorisé a lancer du cron

@+

Re: Crontab problème lancement scripts

Posté : lun. 15 oct. 2018 09:56
par arghlub
Non rien à voir avec les droits par contre....

Pour lancer le script toutes les heures, ta ligne cron devrait plutôt ressembler à ça :

Code : Tout sélectionner

0 */1 * * * /home/loutch/Images/hourWallpapers.sh

Re: Crontab problème lancement scripts

Posté : lun. 15 oct. 2018 10:12
par loutch
Re

ok
donc fait un

Code : Tout sélectionner

crontab -r
puis un

Code : Tout sélectionner

crontab -e
j'y ais inséré ta ligne

Code : Tout sélectionner

crontab -l

Code : Tout sélectionner

crontab -l
# For more information see the manual pages of crontab(5) and cron(8)
# 
# m h  dom mon dow   command
0 */1 * * * /home/loutch/Images/hourWallpapers.sh
on verra dans 58 mn

@+

Re: Crontab problème lancement scripts

Posté : lun. 15 oct. 2018 10:18
par cyrille
sinon il y a le générique

Code : Tout sélectionner

@hourly

Code : Tout sélectionner

@hourly /chemin/vers/ma/commande

Re: Crontab problème lancement scripts

Posté : lun. 15 oct. 2018 10:27
par loutch
Re

ok je laisse la commande pour voir si le wall change à 11h sinon je mettrais la tienne.


@+

Re: Crontab problème lancement scripts

Posté : lun. 15 oct. 2018 10:35
par cyrille
les deux doivent passer
elles veulent "dire" la même chose ;)
Donc l'erreur ne viendra pas de là si erreur il y a

Re: Crontab problème lancement scripts

Posté : lun. 15 oct. 2018 11:03
par loutch
11h02 pas de changement de wall je vais changer avec @hourly