On Thu, 22 Jun 2006, George wrote:
Buna ziua!
Pe un Debian am pus in fisierul /etc/profiles niste variabile proprii
cu scopul de a fi vazute de catre toti userii sistemului( le-am pus cu
export nume_variabila="valuare").
Problema apare cand rulez un script care contine aceste variabile din
cron. Daca rulez scriptul din shell, indiferent de userul cu care il
rulez merge. Daca il rulez din cron scriptul considera respectivele
variabile nule.
Am incercat sa lansez respectivele scripturi (de bash) cu /bin/bash
--rcfile=/etc/profile dar fara nici un rezultat. Nici scripturile de
perl nu vad respectivele variabile cand sunt rulate din cron.
Exista vre-o posibilitate sa fac cronul sa vada aceste variabile?
In dillon cron zice ca:
The command portion of the line is run with /bin/sh -c <command> and may
therefore contain any valid bourne shell command.
in manualul de bash zice ca:
If bash is invoked with the name sh, it tries to mimic the startup
behavior of
historical versions of sh as closely as possible, while conforming
to the POSIX
standard as well. When invoked as an interactive login shell, or a
non-inter-
active shell with the --login option, it first attempts to read
and execute
commands from /etc/profile and ~/.profile, in that order. The
--noprofile
option may be used to inhibit this behavior. When invoked as an
interactive
shell with the name sh, bash looks for the variable ENV, expands
its value if
it is defined, and uses the expanded value as the name of a file
to read and
execute. Since a shell invoked as sh does not attempt to read and
execute com-
mands from any other startup files, the --rcfile option has no
effect. A non-
interactive shell invoked with the name sh does not attempt to read
any other
startup files. When invoked as sh, bash enters posix mode after
the startup
files are read.
Sper sa te ajute.
AFAIK daca vrei sa faci chestii mai complicate cu cron e bine sa-ti faci
proprile scripturi care seteaza variabile si alte chestii din astea.
Multumesc anticipat pt raspuns!
Gerge
Calin
--
"frate, trezeste-te, aici nu-i razboiul stelelor"
Radu R. pe offtopic at lug.ro
_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug