Contenu | Rechercher | Menus

Annonce

Si vous avez des soucis pour rester connecté, déconnectez-vous puis reconnectez-vous depuis ce lien en cochant la case
Me connecter automatiquement lors de mes prochaines visites.

À propos de l'équipe du forum.

#1 Le 28/06/2019, à 06:53

den66

crontab -e command not found

Bonjour à tous

Voilà, tout est dans le titre.
J'avais un script sur Ubuntu 14 de sauvegarde des BDD qui fonctionnait.
Je l'ai reporté sur Ubuntu 18. Le script est un fichier dans le dossier cron.daily dont le nom est sauvegarde_mysql sans extension .sh.
Ces droits sont -rwxr-xr-x comme ceux qui sont déjà dans le dossier et comme ceux qui étaient sur le Ubuntu 14.

Mais rien ne se passe.
J'ai essayé de faire crontab -e et là j'ai la réponse command  not found !

Pensez-vous qu'il faut que j'installe anacron ?
Par contre, j'ai remarqué que le fichier crontab n'existait pas. Faut-il le créer ?

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
19 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
46 4    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
8 4     * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
57 4    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --repo$
#

Merci d'avance pour votre aide.
Denis

Hors ligne

#2 Le 28/06/2019, à 08:19

bruno

Re : crontab -e command not found

Bonjour,

Je me demande si le paquet cron est bien installé :

sudo apt install cron

Si ta machine n'est pas un serveur allumé en permanence tu peux aussi installer le paquet anacron.

Hors ligne

#3 Le 28/06/2019, à 09:01

den66

Re : crontab -e command not found

Effectivement, une fois lancé la commande il me l'a installé.
J'ai fait ensuite crontab -l ce qui me donne no crontab for root

J'ai installé anacron et si je fais cat /etc/anacrontab j'obtiens :

# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOME=/root
LOGNAME=root

# These replace cron's entries
1	5	cron.daily	run-parts --report /etc/cron.daily
7	10	cron.weekly	run-parts --report /etc/cron.weekly
@monthly	15	cron.monthly	run-parts --report /etc/cron.monthly

Et mon fichier crontab contient :

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOME=/root
LOGNAME=root

# These replace cron's entries
1	5	cron.daily	run-parts --report /etc/cron.daily
7	10	cron.weekly	run-parts --report /etc/cron.weekly
@monthly	15	cron.monthly	run-parts --report /etc/cron.monthly
root@newden:~# cat /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user	command
17 *	* * *	root    cd / && run-parts --report /etc/cron.hourly
25 6	* * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6	* * 7	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6	1 * *	root	test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

Est-ce que vous pensez que maintenant ça va marcher ou faut-il que je fasse autre chose.
Désolé pour cet amateurisme, j'avais réussi à tout mettre en place sur mon Ubuntu 14... mais c'était il y a un petit paquet d'année maintenant. Du coup, j'ai un peu tout oublié. En plus, je n'avais pas ce genre de problème à l'époque !

Merci pour votre aide.
Denis

Hors ligne

#4 Le 28/06/2019, à 09:27

bruno

Re : crontab -e command not found

Normalement cela devrait fonctionner.
Le fichier crontab indique bien que tous les scripts exécutables (run-parts) présents dans /etc/cron.daily seront exécutés chaque jour à 6h25.

Hors ligne

#5 Le 28/06/2019, à 09:30

den66

Re : crontab -e command not found

Cool

Merci pour cet avis éclairé.
Je vérifie ça demain matin.

Bonne journée, en espérant que vous êtes u peu à l'abris de la chaleur.
Denis

Hors ligne