Nejde úloha z CRONu

Jan Friedel jf at devnull.cz
Thu Mar 29 11:33:39 CEST 2012


	Ahoj,

On Thu, Mar 29, 2012 at 08:46:14AM +0200, Roman Ndhera wrote:
> 
> Dobry den,
> 
> nevimproc mi nechodi uloha z CRONu.
> Jedna se o skript mymail v poslednim radku crontab.
> 
> V /etc/crontab je:
> > # /etc/crontab - root's crontab for FreeBSD
> > #
> > # $FreeBSD$
> > #
> > SHELL=/bin/sh
> > PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
> > #
> > #minute hour    mday    month   wday    who     command
> > #
> > */5     *       *       *       *       root    /usr/libexec/atrun
> > #
> > # Save some entropy so that /dev/random can re-seed on boot.
> > */11    *       *       *       *       operator /usr/libexec/save-entropy
> > #
> > # Rotate log files every hour, if necessary.
> > 0       *       *       *       *       root    newsyslog
> > #
> > # Perform daily/weekly/monthly maintenance.
> > #1      3       *       *       *       root    periodic daily
> > #15     4       *       *       6       root    periodic weekly
> > #30     5       1       *       *       root    periodic monthly
> > #
> > # Adjust the time zone if the CMOS clock keeps local time, as opposed to
> > # UTC time.  See adjkerntz(8) for details.
> > 1,31    0-5     *       *       *       root    adjkerntz -a
> > #
> > 15,45   *       *       *       *       root    /util/mymail >/dev/null 2>&1
> > 
> 
> Obsah soubotu /util/mymail je
> 
> > 
> > #! /bin/bash
> > 
> > sysctl -a | grep -e temperature | cut -c 33-50      > /tmp/statmail.txt
> > smartctl -a /dev/ada0 | grep Temper | cut -c 87-90 >> /tmp/statmail.txt
> > echo ======================================  >> /tmp/statmail.txt
> > cp /var/log/apcupsd.status  /tmp/apcupsd.status.txt
> > cat /var/log/auth.log | grep -e error -e fail >> /tmp/statmail.txt
> > echo ======================================  >> /tmp/statmail.txt
> > 
> > 
> > smtpmail -t moje.adresaa at xxxx.cz \
> >     -H 192.168.1.1         \
> >     -f yyyyyy at xxxx.cz   \
> >     -s "Persefona server report"            \
> >     -a /tmp/apcupsd.status.txt  \
> >     -v                     \
> >     /tmp/statmail.txt
> > 
> > # rm /tmp/statmail.txt
> 
> 
> Když spustím rucne  /util/mymail, tak se provede spravne.
> 
> To mi nekdo reknete, proc cron na to kasle.. 8-(
> 

	Kdyz odstranis presmerovani stdout/stderr do /dev/null z
	crontabu, rekne ti to samotny cron. Kdyz pridas parametr -x za
	interpreter ve skriptu, uvidis i co a jak se spousti.

	/h.


More information about the Users-l mailing list