help with scripting [INACTIVE]

Here we discuss compilation and how to build an addon for BFW.

help with scripting

Mensagempor nachazo » Sáb Set 02, 2006 12:34 am

Hi every body.....

I need to exectue a command that uses a lot of cpu and i don´t want to load a lot the cpu... need to wait 30 seconds and the exectue the command, then need to wait another 30 seconds to execute another command... how i can do that in linux scripting?

thanks and regards.
nachazo
 

Mensagempor Claudio » Sáb Set 02, 2006 10:15 am

while (something) ; do
your_command
sleep 30
done
Não dou suporte via mensagem privada e e-mail.
Por favor, não insista.
Avatar do usuário
Claudio
BFW Founder
BFW Beneméritos
 
Mensagens: 7553
Registrado em: Qui Ago 25, 2005 9:10 am
Localização: Vitória - ES - Brasil
BrazilFW Box:

Mensagempor nachazo » Sáb Set 02, 2006 12:41 pm

thanks you very much....
nachazo
 

Mensagempor nachazo » Ter Out 17, 2006 12:44 pm

Another question!!!

I´m doing s squid check procees script.... Works very well but in some cases fail.... because i check if the squid.pid file still exist in /var/run...

Yesterday squid procees died but squid.pid continued in /var/run... for these reason my script can´t detect that squid was die...

here is my actual script:

Código: Selecionar todos
#!/bin/sh
#
DEBUG=0

# argentobr variables
. /argentobr/variables.conf
. /argentobr/mailsend.conf
if [ -n "`ls /var/run/squid.pid`" ] ; then
               echo "squid esta funcionando"
               
            else
               echo "squid no esta funcionando"
               /argentobr/squidstart
               /argentobr/mailsend -d $host -smtp $smtp -t $para -f $de -sub "$asunto" < $mensaje

               
            fi

echo ""



I know if i use squid -k check command it will return to me a message... How can i do a script that returns to me a variable with 0 or 1.... 0 for squid is running... 1 for squid stop...

Regards...
nachazo
 

Mensagempor Claudio » Ter Out 17, 2006 1:37 pm

Try something like this:

if [ -n "`ps | grep squid`" ] ; then .....

ps = list running process
grep = search for the string squid
-n = return true if the argument is not empty
Não dou suporte via mensagem privada e e-mail.
Por favor, não insista.
Avatar do usuário
Claudio
BFW Founder
BFW Beneméritos
 
Mensagens: 7553
Registrado em: Qui Ago 25, 2005 9:10 am
Localização: Vitória - ES - Brasil
BrazilFW Box:

Mensagempor nachazo » Ter Out 17, 2006 4:11 pm

Thank you very much claudio... I will try...
nachazo
 

Mensagempor nachazo » Sex Out 20, 2006 10:51 pm

Sorry Claudio your idea don´t work well..

But i fix it.....

I use the $ variable... i put something like this:

squid -k check
if [ $ = 0 ] ; then

--------------------------------

Thank you and i hope that this experience will be useful for others...

Regards.
nachazo
 

Mensagempor nachazo » Dom Dez 31, 2006 6:48 am

Another question....

How can i send messages to syslog?

I doing a script and in some circuntances i want to send messages to syslog....

anybady knows how i can do that?

Regards.
nachazo
 

Mensagempor Claudio » Dom Dez 31, 2006 10:53 am

logger "anything you want"
Não dou suporte via mensagem privada e e-mail.
Por favor, não insista.
Avatar do usuário
Claudio
BFW Founder
BFW Beneméritos
 
Mensagens: 7553
Registrado em: Qui Ago 25, 2005 9:10 am
Localização: Vitória - ES - Brasil
BrazilFW Box:

Mensagempor nachazo » Dom Dez 31, 2006 4:40 pm

Thanks Claudio!

Happy New Year!
nachazo
 


Voltar para Add-On Factory

Quem está online

Usuários navegando neste fórum: Google [Bot] e 6 visitantes

cron