Questin de newbie comment quitter et sauvegarder crontab

salut
tout est dit dans le titre quand je fais :
$crontab -e
comment on fais pour quitter et sauvegarder je fais ctrl+c et :wq! mais aucun ne marche

Salut,

Ctrl + x et Ctrl + o puis “Enter” si tu as modifié (ajout).

ça fonctionne pas ctrl+o supprime ce qui a dans le fichier

As tu modifié/ajouter une tâche ?

Pour quitter: Ctrl + x
Pour enregistrer après modification: Ctrl (gauche)+ x puis Ctrl (gauche) + o et “enter”

ps: une erreur dans ta crontab ? Quel est le message d’erreur ?

:033 du genre …

# crontab -e crontab: installing new crontab "/tmp/crontab.G6nVYY/crontab":30: bad day-of-week errors in crontab file, can't install. Do you want to retry the same edit? (y/n)

marche pas j’ai aucune erreur ctrl+x fait rien et ctrl+o supprime

En root!

Ctrl + x Ctrl + o "Enter"

Que fais tu exactement ? :mrgreen:

:mrgreen:

* edit *

# nano /var/spool/cron/crontabs/root 

Ctrl + x
Ctrl + o
“enter”

[code]~ # cat /var/spool/cron/crontabs/root

DO NOT EDIT THIS FILE - edit the master and reinstall.

(/tmp/crontab.G6nVYY/crontab installed on Sun Sep 23 12:58:16 2012)

(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.

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

MAILTO=xxxxxxxxxxxxxxxx@xxxxxxxx.tld


[root@pc-2-loreleil] ~ #[/code]

je fais :

la ça m’ouvre ceci:

    I    /tmp/crontab.1V7zF9/crontab  Row 23   Col 48   3:23  Ctrl-K H for help
#
# 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

je l’edite et je fais ctrl+x puis ctrl+o entrer comme tu me l’as dit mais sa marche pas comme je te les dit quand je fais ctrl+o ça supprime.

Ps j’ai aucun dossier dans /var/spool/cron/crontabs/ est ce normal

Que contient ce fichier ?

[quote]Ps j’ai aucun dossier dans /var/spool/cron/crontabs/ est ce normal
[/quote]
Que donne:

Si absent!

Relances crontab

c’est le meme fichier crontab

[code] I /tmp/crontab.1V7zF9/crontab Row 23 Col 48 3:23 Ctrl-K H for help

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[/code]

ctrl+x ne fais rien
ctrl+o supprime
et ENTRER descent d’une ligne

Soucis avec tes touches clavier ?

Ouvres un fichier avec nano.

En simple user.

~ $ nano /home/ton_user/essai_crontab

Par exemple …

Tapes y touches les touches de ton clavier. Sont telles adéquates ?
Ctrl + x
Ctrl + o
enter

?

:017 $ apt-cache policy cron anacron
?

Quels sont les retours des deux post précédant ?

# ls -la /var/spool/cron/crontabs/

?

# touch /var/spool/cron/crontabs/root ?

oui quand je procède de cette manière cela fonctionne

C’est à dire ? :mrgreen:

$ man crontab

      The -e option is used to edit the  current  crontab  using  the  editor
       specified  by  the  VISUAL  or EDITOR environment variables.  After you
       exit from the editor, the modified crontab will be installed  automati‐
       cally.  If  neither  of  the environment variables is defined, then the
       default editor /usr/bin/editor is used.

$ echo $EDITOR
$ echo $VISUAL
$ ls -l /usr/bin/editor

/usr/bin/editor, lien vers /etc/alternatives/editor
$ ls -l /etc/alternatives/editor
lui-même lien vers un éditeur en /usr/bin.

Les raccourcis dépendent de l’éditeur, loreleil utilise nano, tu utilises un autre éditeur.

Imaginons que tu souhaites que l’éditeur soit
nano.
$ export EDITOR=/usr/bin/nano
mcedit
$ export EDITOR=/usr/bin/mcedit
vim
$ export EDITOR=/usr/bin/vim

cool cest bon merci

alcaline, un barbus, est là. :wink:

[quote=“etxeberrizahar”]$ man crontab

      The -e option is used to edit the  current  crontab  using  the  editor
       specified  by  the  VISUAL  or EDITOR environment variables.  After you
       exit from the editor, the modified crontab will be installed  automati‐
       cally.  If  neither  of  the environment variables is defined, then the
       default editor /usr/bin/editor is used.

$ echo $EDITOR
$ echo $VISUAL
$ ls -l /usr/bin/editor

/usr/bin/editor, lien vers /etc/alternatives/editor
$ ls -l /etc/alternatives/editor
lui-même lien vers un éditeur en /usr/bin.

Les raccourcis dépendent de l’éditeur, loreleil utilise nano, tu utilises un autre éditeur.

Imaginons que tu souhaites que l’éditeur soit
nano.
$ export EDITOR=/usr/bin/nano
mcedit
$ export EDITOR=/usr/bin/mcedit
vim
$ export EDITOR=/usr/bin/vim
…[/quote]
etxeberrizahar :wink:

[quote=“loreleil”]Salut,

Ctrl + x et Ctrl + o puis “Enter” si tu as modifié (ajout).[/quote]
Ce n’est pas le bon ordre, tout au moins si la modif a été faite sous nano :
Ctrl+o ; puis entrée ; puis Ctrl+x

Re,

[quote=“ricardo”][quote=“loreleil”]Salut,

Ctrl + x et Ctrl + o puis “Enter” si tu as modifié (ajout).[/quote]
Ce n’est pas le bon ordre, tout au moins si la modif a été faite sous nano :
Ctrl+o ; puis entrée ; puis Ctrl+x[/quote]

Sous nano.

Que importe l’ordre donné.

Ctrl + x
o
enter

ça le fait! :033

Ctrl+x = sortie
donc tu sors AVANT d’avoir sauvegardé avec Ctrl+o
Tu es sûr qu’il a été tenu compte de tes modifs dans ce cas ?
:017

C’est ce que je fais toujours : Ctrl+X, voulez-vous sauvegarder ? o, dans quel fichier ? Entrée :wink:

Arrêtez avec votre haut nanisme, à mon humble avis alcaline était en présence d’ed.

ed, bien entendu, l’éditeur de texte

q comme quit…