removido
(usa Nenhuma)
Enviado em 20/05/2010 - 17:42h
Bom pessoa tenho um script que ele nao exetudo quando inicia junto ao OS.
E nem funciona no crontab.
O script funciona, eu sei pq quando eu executo ./script ele funciona e quando coloco no /etc/profile tbm funciona.
acho quem alguma coisa haver com as variaveis de ambiente.
segue abaixo o script:
..................................................................................................
#Autor: Antonio Edmilson
#Script verifica se existe algum processo do python levantado
#se tiver ele mata e levanta novamente.
#Se nao tiver nenhum processo levantado ele simplesmente levanta o processo.
#Inicio do Script
#Variaveis
#sig, user, tmp
#!/bin/bash
user=`id -un`
sig=`ps aux | grep ImportRetag.py`
echo $sig > /tmp/$user
possicao=`cut -d " " -f11 /tmp/$user`
tmp=`cut -d " " -f2 /tmp/$user`
if [[ $possicao = "python" ]]; then
sudo kill -9 $tmp
python /usr/local/bin/ImportRetag.py /mm/logs/ /usr/local/sigpdv/arq_configuracao /mm/arquivos/ /usr/local/sigpdv/arq_supervisor
else
python /usr/local/bin/ImportRetag.py /mm/logs/ /usr/local/sigpdv/arq_configuracao /mm/arquivos/ /usr/local/sigpdv/arq_supervisor
fi
rm -rf /tmp/$user
#Fim do Script
..................................................................................................
segue a baixo o meu set na inicialização do sistema;
BASH=/bin/sh
BASH_ARGC=([0]="1")
BASH_ARGV=([0]="start")
BASH_LINENO=([0]="0")
BASH_SOURCE=([0]="/etc/rc5.d/S99python")
BASH_VERSINFO=([0]="3" [1]="00" [2]="15" [3]="1" [4]="release" [5]="i686-redhat-linux-gnu")
BASH_VERSION='3.00.15(1)-release'
CONSOLE=/dev/pts/0
DIRSTACK=()
EUID=0
GROUPS=()
HOME=/
HOSTNAME=localhost.localdomain
HOSTTYPE=i686
IFS='
'
INIT_VERSION=sysvinit-2.85
LANG=pt_BR.UTF-8
MACHTYPE=i686-redhat-linux-gnu
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
POSIXLY_CORRECT=y
PPID=2894
PREVLEVEL=N
PS4='+ '
PWD=/
RUNLEVEL=5
SELINUX_INIT=YES
SHELL=/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments:posix
SHLVL=2
TERM=linux
UID=0
_=/bin/sh
previous=N
runlevel=5
........................................................................
Agora o set de um usuario depois que o OS ja inicializou todo e que o script funciona.
BASH=/bin/bash
BASH_ARGC=()
BASH_ARGV=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="3" [1]="00" [2]="15" [3]="1" [4]="release" [5]="i686-redhat-linux-gnu")
BASH_VERSION='3.00.15(1)-release'
COLORS=/etc/DIR_COLORS.xterm
COLUMNS=124
DIRSTACK=()
DISPLAY=:0.0
EUID=0
GROUPS=()
G_BROKEN_FILENAMES=1
HISTFILE=/root/.bash_history
HISTFILESIZE=1000
HISTSIZE=1000
HOME=/root
HOSTNAME=localhost.localdomain
HOSTTYPE=i686
IFS=$' \t\n'
INPUTRC=/etc/inputrc
KDEDIR=/usr
LANG=pt_BR.UTF-8
LESSOPEN='|/usr/bin/lesspipe.sh %s'
LINES=39
LOGNAME=root
LS_COLORS='no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:'
MACHTYPE=i686-redhat-linux-gnu
MAIL=/var/spool/mail/root
MAILCHECK=60
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
PIPESTATUS=([0]="0")
PPID=14719
PROMPT_COMMAND='echo -ne "{TTEXTO}33]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}{TTEXTO}07"'
PS1='[\u@\h \W]\$ '
PS2='> '
PS4='+ '
PWD=/root
SHELL=/bin/bash
SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
SHLVL=1
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SUPPORTED=pt_BR.UTF-8:pt_BR:pt
TERM=xterm
UID=0
USER=root
XAUTHORITY=/root/.xauthN7qVxA
_=/tmp/inicializacao
........................................................................
ai galera aguardo resposta.
muito obrigado.