Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Vixie-Cron e Esecuzione da utente
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)
View previous topic :: View next topic  
Author Message
Pancu
l33t
l33t


Joined: 16 Feb 2005
Posts: 612
Location: Cesena

PostPosted: Thu Dec 15, 2005 2:48 pm    Post subject: Vixie-Cron e Esecuzione da utente Reply with quote

Ragazzi ho un problemino con Vixie-Cron.
Dovrei far eseguire questo comando ogni 3 minuti in modo che una volta lo esegua l'utente pancu e subito dopo l'utente vally.
Code:
 /usr/bin/fetchmail -a -s -m "/usr/bin/procmail -d %T"

Come faccio a dire a vixie-cron di farlo partire da utente e non da root???
Grazie!
Back to top
View user's profile Send private message
salade
Apprentice
Apprentice


Joined: 10 May 2004
Posts: 170

PostPosted: Thu Dec 15, 2005 2:51 pm    Post subject: Reply with quote

Code:

su nome_utente -c "comando"

:wink:

NB: Chiaramente metti le \ prima delle "" del tuo comando di fetchmail ;)
Back to top
View user's profile Send private message
Pancu
l33t
l33t


Joined: 16 Feb 2005
Posts: 612
Location: Cesena

PostPosted: Thu Dec 15, 2005 3:23 pm    Post subject: Reply with quote

Non ho capito dove devo mettere le \.
Scusami!
Grazie ancora!
Back to top
View user's profile Send private message
randomaze
Bodhisattva
Bodhisattva


Joined: 21 Oct 2003
Posts: 9985

PostPosted: Thu Dec 15, 2005 3:30 pm    Post subject: Reply with quote

Esiste un motivo per non usare i crontab degli utenti?
_________________
Ciao da me!
Back to top
View user's profile Send private message
salade
Apprentice
Apprentice


Joined: 10 May 2004
Posts: 170

PostPosted: Thu Dec 15, 2005 3:39 pm    Post subject: Reply with quote

randomaze wrote:
Esiste un motivo per non usare i crontab degli utenti?

in effetti...

cmq:
Code:

su pancu -c "/usr/bin/fetchmail -a -s -m \"/usr/bin/procmail -d %T\""
Back to top
View user's profile Send private message
Pancu
l33t
l33t


Joined: 16 Feb 2005
Posts: 612
Location: Cesena

PostPosted: Thu Dec 15, 2005 3:39 pm    Post subject: Reply with quote

randomaze wrote:
Esiste un motivo per non usare i crontab degli utenti?

No il problema è che pensavo si potesse realizzare un solo crontab.
Allora.
Se io metto controllo.crons dentro /home/vally e controllo1.crons dentro /home/pancu e faccio un :
Code:
crontab /home/vally/controllo.crons
crontab /home/pancu/controllo1.crons

Lui me li considera tutti e due o prende in considerazione l'ultimo file aggiunto??
Grazie!
Back to top
View user's profile Send private message
.:chrome:.
Advocate
Advocate


Joined: 19 Feb 2005
Posts: 4588
Location: Brescia, Italy

PostPosted: Thu Dec 15, 2005 5:56 pm    Post subject: Re: Vixie-Cron e Esecuzione da utente Reply with quote

ehm... lascia perdere soluzioni strane tipo sudo...
devi aggiungere gli utenti autorizzati ad usare cron nel gruppo gron:
Code:
gpasswd -a utente gruppo

e poi ogni utente potrà usare il classico
Code:
crontab -e
Back to top
View user's profile Send private message
Pancu
l33t
l33t


Joined: 16 Feb 2005
Posts: 612
Location: Cesena

PostPosted: Fri Dec 16, 2005 12:54 pm    Post subject: Reply with quote

Niente da fare. :(
Ho aggiunto gli utenti pancu e vally al gruppo cron.
Faccio prima loggato come pancu poi da vally.
Code:
crontab controlloposta.cron

dove controlloposta.cron è :
Code:
*/3 * * * * /usr/bin/fetchmail -a -s -m "/usr/bin/procmail -d %T"

Nel file di log c'è solo questa informazione:
Code:
Dec 16 13:54:01 andreasv cron[8730]: (vally) CMD (/usr/bin/fetchmail -a -s -v -m "/usr/bin/procmail -d )
Dec 16 13:54:01 andreasv cron[8732]: (pancu) CMD (/usr/bin/fetchmail -a -s -v -m "/usr/bin/procmail -d )

Di fatto xò la posta non viene scaricata.
Se invece eseguo la stessa istruzione da utente funziona tutto bene.
Potete aiutarmi?? :( :(
Grazie.
Back to top
View user's profile Send private message
comio
Advocate
Advocate


Joined: 03 Jul 2003
Posts: 2191
Location: Taranto

PostPosted: Fri Dec 16, 2005 1:20 pm    Post subject: Reply with quote

Pancu wrote:
Niente da fare. :(
Ho aggiunto gli utenti pancu e vally al gruppo cron.
Faccio prima loggato come pancu poi da vally.
Code:
crontab controlloposta.cron

dove controlloposta.cron è :
Code:
*/3 * * * * /usr/bin/fetchmail -a -s -m "/usr/bin/procmail -d %T"

Nel file di log c'è solo questa informazione:
Code:
Dec 16 13:54:01 andreasv cron[8730]: (vally) CMD (/usr/bin/fetchmail -a -s -v -m "/usr/bin/procmail -d )
Dec 16 13:54:01 andreasv cron[8732]: (pancu) CMD (/usr/bin/fetchmail -a -s -v -m "/usr/bin/procmail -d )

Di fatto xò la posta non viene scaricata.
Se invece eseguo la stessa istruzione da utente funziona tutto bene.
Potete aiutarmi?? :( :(
Grazie.

usa "crontab -e" per inserire i jobbini.

ciao
_________________
RTFM!!!!

e

http://www.comio.it
:)
Back to top
View user's profile Send private message
Pancu
l33t
l33t


Joined: 16 Feb 2005
Posts: 612
Location: Cesena

PostPosted: Fri Dec 16, 2005 1:38 pm    Post subject: Reply with quote

comio wrote:
Pancu wrote:
Niente da fare. :(
Ho aggiunto gli utenti pancu e vally al gruppo cron.
Faccio prima loggato come pancu poi da vally.
Code:
crontab controlloposta.cron

dove controlloposta.cron è :
Code:
*/3 * * * * /usr/bin/fetchmail -a -s -m "/usr/bin/procmail -d %T"

Nel file di log c'è solo questa informazione:
Code:
Dec 16 13:54:01 andreasv cron[8730]: (vally) CMD (/usr/bin/fetchmail -a -s -v -m "/usr/bin/procmail -d )
Dec 16 13:54:01 andreasv cron[8732]: (pancu) CMD (/usr/bin/fetchmail -a -s -v -m "/usr/bin/procmail -d )

Di fatto xò la posta non viene scaricata.
Se invece eseguo la stessa istruzione da utente funziona tutto bene.
Potete aiutarmi?? :( :(
Grazie.

usa "crontab -e" per inserire i jobbini.

ciao

Forse non mi sono spiegato, i file di cron vengono eseguiti infatti dentro /var/log/messages ogni tre minuti si vede la seguente stringa:
Code:
Dec 16 13:54:01 andreasv cron[8730]: (vally) CMD (/usr/bin/fetchmail -a -s -v -m "/usr/bin/procmail -d )
Dec 16 13:54:01 andreasv cron[8732]: (pancu) CMD (/usr/bin/fetchmail -a -s -v -m "/usr/bin/procmail -d )

Il problema è che la posta in realtà non viene scaricata e non mi riesco a spiegare il perchè visto che se eseguo:
Code:
/usr/bin/fetchmail -a -s -m "/usr/bin/procmail -d %T"

da utente pancu o vally viene eseguito tutto correttamente..
Back to top
View user's profile Send private message
PboY
Apprentice
Apprentice


Joined: 02 Feb 2005
Posts: 238
Location: Italia - Monza

PostPosted: Fri Dec 16, 2005 2:06 pm    Post subject: Reply with quote

Pancu wrote:

Forse non mi sono spiegato, i file di cron vengono eseguiti infatti dentro /var/log/messages ogni tre minuti si vede la seguente stringa:
Code:
Dec 16 13:54:01 andreasv cron[8730]: (vally) CMD (/usr/bin/fetchmail -a -s -v -m "/usr/bin/procmail -d )
Dec 16 13:54:01 andreasv cron[8732]: (pancu) CMD (/usr/bin/fetchmail -a -s -v -m "/usr/bin/procmail -d )



se noti bene alla fine del comando manca
Code:
"
.. è lo stesso problema che ho avuto io ... creati uno script tipo questo
Code:

#!/bin/bash
/usr/bin/fetchmail -a -s -m "/usr/bin/procmail -d %T"


lo piazzi un /usr/bin/ lo rendi eseguibile e dici a cron di eseguire quello script e vedi che funziona :)
Back to top
View user's profile Send private message
comio
Advocate
Advocate


Joined: 03 Jul 2003
Posts: 2191
Location: Taranto

PostPosted: Fri Dec 16, 2005 2:10 pm    Post subject: Reply with quote

ricordatevi di usare anche il simbolo \, inoltre è buona norma redirigere ogni forma di output.

ciao
_________________
RTFM!!!!

e

http://www.comio.it
:)
Back to top
View user's profile Send private message
Pancu
l33t
l33t


Joined: 16 Feb 2005
Posts: 612
Location: Cesena

PostPosted: Fri Dec 16, 2005 2:27 pm    Post subject: Reply with quote

comio wrote:
ricordatevi di usare anche il simbolo \, inoltre è buona norma redirigere ogni forma di output.

ciao

Comio, scusa la mia ignoranza, potresti gentilmente spiegarmi dove usare il simbolo slash??
Per quanto riguarda l'output del comando lo rediretto in questo modo:
Code:
#!/bin/bash
/usr/bin/fetchmail -a -s -m "/usr/bin/procmail -d %T" &>/dev/null

Può andare bene??
Avevo letto che in questo modo viene cancellato l'output.
Non mi sembra il caso di spedirmi via email ogni 3 minuti l'output dell'email.
Sbaglio???
Grazie mille!
Back to top
View user's profile Send private message
salade
Apprentice
Apprentice


Joined: 10 May 2004
Posts: 170

PostPosted: Fri Dec 16, 2005 4:36 pm    Post subject: Reply with quote

io metterei una \ prima di % ;)
Back to top
View user's profile Send private message
gutter
Bodhisattva
Bodhisattva


Joined: 13 Mar 2004
Posts: 7162
Location: Aarau, Aargau, Switzerland

PostPosted: Sat Dec 17, 2005 8:41 pm    Post subject: Reply with quote

salade wrote:
io metterei una \ prima di % ;)


E' perfettamente inutile visto che la stringa è quotata.
_________________
Registered as User #281564 and Machines #163761
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) 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