crontab

F

flugopa

Hallo,

irgendwas verstehe ich heute nicht...

Code:
#echo $UID
0

#set
.
.
.
Holz=333
Kohle=444
.
.
.

#cat /usr/local/sbin/skript1

#!/bin/sh
Blumen=111
Obst=222
echo -e "Eintrag 1: $Blumen.$Obst">/tmp/eee
echo -e "Eintrag 2: $Holz.$Kohle">/tmp/eee


#chmod 550 /usr/local/sbin/skript1

#crontab -l
*/5 * * * * root /usr/local/sbin/skript1

#cat /tmp/eee
111.222
.


Der richtige Inhalt sollte so sein:
Code:
#cat /tmp/eee
111.222
333.444


Frage: Warum erscheint nicht das erwartete Ergebnis?
 
in der Umgebung von cron sind nicht immer die gleichen Variablen gesetzt wie in der Login-Umgebung.

-> Cron anweisen, das entsprechende Script, in dem die Variablen gesetzt werden, zu sourcen.
 
Hallo marce,

vielen Dank für Deine schnelle Reaktion und Mühe,
aber was meinst Du mit "sourcen"?

Sorry, aber ich stehe heute etwas auf der Leitung.
 
Code:
man source
meint dazu
Code:
        .  filename [arguments]
       source filename [arguments]
              Read and execute commands from filename in the current shell environment and return the exit  sta-
              tus  of the last command executed from filename.  If filename does not contain a slash, file names
              in PATH are used to find the directory containing filename.  The file searched for  in  PATH  need
              not  be  executable.  When bash is not in posix mode, the current directory is searched if no file
              is found in PATH.  If the sourcepath option to the shopt builtin command is turned off,  the  PATH
              is  not searched.  If any arguments are supplied, they become the positional parameters when file-
              name is executed.  Otherwise the positional parameters are unchanged.  The return  status  is  the
              status  of the last command exited within the script (0 if no commands are executed), and false if
              filename is not found or cannot be read.
 
Sorry, daß ich mich erst jetzt wieder melde....
Gesundheitlich geht es wieder aufwärts.

Danke für die Info.
 

Ähnliche Themen

Shellskript - Fehler in Cron

Problem mit HSPA+ Modem Huawei E353 - Installation unmöglich?

Koplizierte Sache.. AWK oder SED ??

Postfix issue

Bekomme MySQL nicht zum laufen

Zurück
Oben