Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Risolto] Circa Vixie-cron.
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano
View previous topic :: View next topic  
Author Message
ciro64
Guru
Guru


Joined: 20 Jun 2009
Posts: 424

PostPosted: Tue Dec 30, 2014 12:41 pm    Post subject: [Risolto] Circa Vixie-cron. Reply with quote

Ave a tutti :)
Perdonate i miei neuroni ma .... faccio fatica a capire come impostare correttamente vixie-cron; ho letto la guida
Vixie-cron è impostato per attivarsi in runlevel Default.

Ho aggiunto solo una istruzione, presente in crons.cron:
Code:

*       *       *       1-12    1               /sbin/fstrim -v -a

E naturalmente ho dato
Code:

# crontab crons.cron


Di conseguenza il mio "crontab -l" dice:
Code:

# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/home/sandro/Funtoo/crons.cron installed on Sun Dec 21 22:10:02 2014)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
*       *       *       1-12    1               /sbin/fstrim -v -a


In teoria dovrebbe eseguire l'operazione il primo di ogni mese, mentre noto che in /var/mail/root mi dice che praticamente viene eseguito ogni minuto :-o

ho installato anacron; ma serve o no con vixie-cron ?

Cos'altro ho "cannato" ?

Grazie a chi mi sappia chiarificare la situazione :oops:
_________________
Gentoo: il sistema più eclettico e geniale che abbia mai provato :)


Last edited by ciro64 on Fri Jan 02, 2015 8:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
sabayonino
Veteran
Veteran


Joined: 03 Jan 2012
Posts: 1008

PostPosted: Tue Dec 30, 2014 1:28 pm    Post subject: Reply with quote

https://wiki.gentoo.org/wiki/Cron

la sintassi sembra giusta

ma basterebbe anche solo 1-12 riguardo il mese) . cron viene avviato ogni 00.00 del primo se non indicato diversamente

Code:
* * * 1-12 * blah blah



puoi postare l'output di /var/mail/root ?
_________________
LRS i586 on G.Drive
LRS x86-64 EFI on MEGA
Back to top
View user's profile Send private message
ciro64
Guru
Guru


Joined: 20 Jun 2009
Posts: 424

PostPosted: Tue Dec 30, 2014 1:43 pm    Post subject: Reply with quote

Grazie, farò così.
Però nella guida diceva di commentare le righe in
Code:

$ cat /etc/crontab

# for vixie cron
# $Header: /var/cvsroot/gentoo-x86/sys-process/vixie-cron/files/crontab-3.0.1-r4,v 1.3 2011/09/20 15:13:51 idl0r Exp $

# Global variables
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly
59  *  * * *    root    rm -f /var/spool/cron/lastrun/cron.hourly
9  3  * * *     root    rm -f /var/spool/cron/lastrun/cron.daily
19 4  * * 6     root    rm -f /var/spool/cron/lastrun/cron.weekly
29 5  1 * *     root    rm -f /var/spool/cron/lastrun/cron.monthly
*/10  *  * * *  root    test -x /usr/sbin/run-crons && /usr/sbin/run-crons


devo commentare tutto o le ultime 6?
_________________
Gentoo: il sistema più eclettico e geniale che abbia mai provato :)
Back to top
View user's profile Send private message
sabayonino
Veteran
Veteran


Joined: 03 Jan 2012
Posts: 1008

PostPosted: Tue Dec 30, 2014 7:25 pm    Post subject: Reply with quote

quelle righe servono per controllare ed eseguire gli scripts in quelle directory , e se ci sta di mezzo pore anacron meglio ancora per un sistema non H24

se le rimuovi , gli script (alcuni di sistema) non verranno eseguiti.

manca l'output che ti ho richiesto :D
_________________
LRS i586 on G.Drive
LRS x86-64 EFI on MEGA
Back to top
View user's profile Send private message
ciro64
Guru
Guru


Joined: 20 Jun 2009
Posts: 424

PostPosted: Tue Dec 30, 2014 11:34 pm    Post subject: Reply with quote

Boh avevo eliminato /var/mail/root
però avevo aggiunto anacron. provo a rimuoverlo e vedo che fa...
scusate e perdonate la mia scarsissima capacità di comprensione.
_____________________________________________________

PS: rimosso anacron ecco "riapparire le copiose mails in /var/mail/root

Code:

ci74771ht ~ # emerge -C anacron
 * This action can remove important packages! In order to be safer, use
 * `emerge -pv --depclean <atom>` to check for reverse dependencies before
 * removing packages.

 sys-process/anacron
    selected: 2.3-r2
   protected: none
     omitted: none

All selected packages: sys-process/anacron-2.3-r2

>>> 'Selected' packages are slated for removal.
>>> 'Protected' and 'omitted' packages will not be removed.

>>> Waiting 5 seconds before starting...
>>> (Control-C to abort)...
>>> Unmerging in:  5 4 3 2 1
>>> Unmerging (1 of 1) sys-process/anacron-2.3-r2...

 * GNU info directory index is up-to-date.
You have new mail in /var/mail/root
ci74771ht ~ # cat /var/mail/root
From root@localhost.localdomain Wed Dec 31 00:33:01 2014
Return-Path: <root@localhost.localdomain>
Received: from localhost.localdomain (ci74771ht [127.0.0.1])
        by localhost.localdomain (8.14.9/8.14.9) with ESMTP id sBUNX1FN025449
        for <root@localhost.localdomain>; Wed, 31 Dec 2014 00:33:01 +0100
Received: (from root@localhost)
        by localhost.localdomain (8.14.9/8.14.9/Submit) id sBUNX1YD025446;
        Wed, 31 Dec 2014 00:33:01 +0100
Date: Wed, 31 Dec 2014 00:33:01 +0100
Message-Id: <201412302333.sBUNX1YD025446@localhost.localdomain>
From: root@localhost.localdomain (Cron Daemon)
To: root@localhost.localdomain
Subject: Cron <root@ci74771ht> /sbin/fstrim -v -a
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

/: 16.4 GiB (17552486400 bytes) trimmed

From root@localhost.localdomain Wed Dec 31 00:34:02 2014
Return-Path: <root@localhost.localdomain>
Received: from localhost.localdomain (ci74771ht [127.0.0.1])
        by localhost.localdomain (8.14.9/8.14.9) with ESMTP id sBUNY2SE030920
        for <root@localhost.localdomain>; Wed, 31 Dec 2014 00:34:02 +0100
Received: (from root@localhost)
        by localhost.localdomain (8.14.9/8.14.9/Submit) id sBUNY2gW030919;
        Wed, 31 Dec 2014 00:34:02 +0100
Date: Wed, 31 Dec 2014 00:34:02 +0100
Message-Id: <201412302334.sBUNY2gW030919@localhost.localdomain>
From: root@localhost.localdomain (Cron Daemon)
To: root@localhost.localdomain
Subject: Cron <root@ci74771ht> /sbin/fstrim -v -a
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

/: 16.4 GiB (17552277504 bytes) trimmed

From root@localhost.localdomain Wed Dec 31 00:35:01 2014
Return-Path: <root@localhost.localdomain>
Received: from localhost.localdomain (ci74771ht [127.0.0.1])
        by localhost.localdomain (8.14.9/8.14.9) with ESMTP id sBUNZ1Sg000712
        for <root@localhost.localdomain>; Wed, 31 Dec 2014 00:35:01 +0100
Received: (from root@localhost)
        by localhost.localdomain (8.14.9/8.14.9/Submit) id sBUNZ1QS000711;
        Wed, 31 Dec 2014 00:35:01 +0100
Date: Wed, 31 Dec 2014 00:35:01 +0100
Message-Id: <201412302335.sBUNZ1QS000711@localhost.localdomain>
From: root@localhost.localdomain (Cron Daemon)
To: root@localhost.localdomain
Subject: Cron <root@ci74771ht> /sbin/fstrim -v -a
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

/: 16.4 GiB (17553084416 bytes) trimmed


Grazie per l'attenzione e il supporto :)
_________________
Gentoo: il sistema più eclettico e geniale che abbia mai provato :)
Back to top
View user's profile Send private message
sabayonino
Veteran
Veteran


Joined: 03 Jan 2012
Posts: 1008

PostPosted: Wed Dec 31, 2014 12:03 am    Post subject: Reply with quote

prova a rimuovere quel cron file e prova utilizzare direttamente /etc/crontab reindirizzando l'output del comando verso un file di log

/etc/crontab wrote:
* * * 1-12 * root /sbin/fstrim -v -a > /var/log/fstrim.log


e vedi che succede controllando /var/log/fstrim.log dopo un paio di minuti (il file dovrebbe risultare vuoto essendo impostato per ogni mese)



poi vediam il dafarsi
_________________
LRS i586 on G.Drive
LRS x86-64 EFI on MEGA
Back to top
View user's profile Send private message
xdarma
l33t
l33t


Joined: 08 Dec 2003
Posts: 719
Location: tra veneto e friuli (italy)

PostPosted: Thu Jan 01, 2015 5:11 pm    Post subject: Re: Circa Vixie-cron. Reply with quote

ciro64 wrote:
Ho aggiunto solo una istruzione, presente in crons.cron:
Code:

*       *       *       1-12    1               /sbin/fstrim -v -a


In teoria dovrebbe eseguire l'operazione il primo di ogni mese, mentre noto che in /var/mail/root mi dice che praticamente viene eseguito ogni minuto :-o

Per queste operazioni dovrebbe bastare cron se sai quando è acceso il computer.
Altrimenti dovresti usare anacron.
Hai provato a sostituire gli asterischi con "numeri"?
Di solito l'asterisco significa "ogni", se imposti qualcosa tipo:
Code:

00       01       1       *    *               /sbin/fstrim -v -a

Cosa restituisce?
Dovrebbe eseguire il trim alle 1:00 del primo giorno di ogni mese.
Ammesso che sia acceso ;-)
_________________
proud user of faKeDE-4.7.3 -> back to windowmaker -> moved to LXQt
Back to top
View user's profile Send private message
ciro64
Guru
Guru


Joined: 20 Jun 2009
Posts: 424

PostPosted: Thu Jan 01, 2015 10:11 pm    Post subject: Reply with quote

@ Sabayonino: ho modificato il corntab (però ho usato ">>" anzichè ">" altrimenti non posso contare quante volte viene eseguito.
Ho pulito crontab quindi inserita la stringa in /etc/crontab.

Risultato ( tempo di bere un cafferino e fumare una sigaretta ) :

Code:

ci74771ht ~ # cat /var/log/fstrim.log
ci74771ht ~ # cat /var/log/fstrim.log

/: 20.9 GiB (22452240384 bytes) trimmed
/: 20.9 GiB (22452240384 bytes) trimmed
/: 20.9 GiB (22452649984 bytes) trimmed
/: 20.9 GiB (22452932608 bytes) trimmed



@Xdarma
Con la tua stringa ha fatto solo 1 fstrim (anche se avrebbe non dovuto farlo o sbaglio) ?
__________________________________________________________________________

PS: ho provare a rifare tutto da capo; quindi son tornato alla I stringa però lasciando creare e fare l'"append" per il log per fstrim (Ottimissima idea :P)
Boh .... provo magari a farlo giornaliero per provare .... ma non stasera. Grazie per l'aiuto (però rimango perplesso prima no poi si .... e facevo ripatire il servizio :roll: bah misteri delle "Fede" :D
Comunque prima di mettere il risolto lo "tengo d'occhio ancora un po'. Grazie e Ciao per ora ad entrambi (per il buon Anno siamo già al 2).

[ot]
@Sabayonino: abbiamo entrambi 292 posts :) vabbè ..... cin cin :)
[/ot]
_________________
Gentoo: il sistema più eclettico e geniale che abbia mai provato :)
Back to top
View user's profile Send private message
xdarma
l33t
l33t


Joined: 08 Dec 2003
Posts: 719
Location: tra veneto e friuli (italy)

PostPosted: Fri Jan 02, 2015 5:52 pm    Post subject: Reply with quote

ciro64 wrote:

@Xdarma
Con la tua stringa ha fatto solo 1 fstrim (anche se avrebbe non dovuto farlo o sbaglio) ?

cron non avrebbe dovuto eseguirlo. Ma anacron sì.
ciro64 wrote:

ho installato anacron; ma serve o no con vixie-cron ?

Controlla come hai configurato il tuo computer perché forse sei già a posto. ;-)
_________________
proud user of faKeDE-4.7.3 -> back to windowmaker -> moved to LXQt
Back to top
View user's profile Send private message
ciro64
Guru
Guru


Joined: 20 Jun 2009
Posts: 424

PostPosted: Fri Jan 02, 2015 6:17 pm    Post subject: Reply with quote

@Xdarma: No anacron non c'è; lo misi poi lo tolsi .... probabilmente ho commesso un errore dimenticandomi di "ripulire" /var/log/fstrim.log prima di eseguire con la tua stringa in crontab.

Ultima domanda: se emergo anche anacron, è sufficiente o devo configurarlo in qualche modo particolare in modo che possa far eseguire azioni "pendenti" in crontab ?
_________________
Gentoo: il sistema più eclettico e geniale che abbia mai provato :)
Back to top
View user's profile Send private message
xdarma
l33t
l33t


Joined: 08 Dec 2003
Posts: 719
Location: tra veneto e friuli (italy)

PostPosted: Fri Jan 02, 2015 8:07 pm    Post subject: Reply with quote

ciro64 wrote:
Ultima domanda: se emergo anche anacron, è sufficiente o devo configurarlo in qualche modo particolare in modo che possa far eseguire azioni "pendenti" in crontab ?

Boh, è passato molto tempo e non me lo ricordo.
Comunque dal sito indicato in portage, dalle pagine man e dal file di configurazione dovresti estrapolare qualcosa.

EDIT:
Un punto di partenza direttamente del gentoo-wiki: http://wiki.gentoo.org/wiki/Cron#anacron
_________________
proud user of faKeDE-4.7.3 -> back to windowmaker -> moved to LXQt
Back to top
View user's profile Send private message
ciro64
Guru
Guru


Joined: 20 Jun 2009
Posts: 424

PostPosted: Fri Jan 02, 2015 8:35 pm    Post subject: Reply with quote

Ok .... penso di aver compreso..... bah per ora anacron non mi è necessario tassativamente. Penso possa bastarmi cron.

Grazie Ancora degli aiuti e di nuovo Buon Anno :)
_________________
Gentoo: il sistema più eclettico e geniale che abbia mai provato :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Forum di discussione italiano All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum