cpulimit no ubuntu

Posted by Allen Franco | Posted in Ubuntu | Posted on 23-06-2009

0

O cpulimit é um programa simples que tenta limitar o uso do processador em um processo (expresso em percentagem). É muito útil para controlar tarefas “batch”, já que não é recomendável que “comam” muito processador.

Existem limites para o uso dele,  por exemplo, o meu usuário só controla os meus processos, então o ideal é usar root para controlar todos e tudo.

Vamos lá, para instalar digite:

$ sudo apt-get update
$ sudo apt-get install cpulimit

Vamos testar o limite usando o firefox como exemplo, no caso vamos limitar o uso dele em até 30% do processador.

$ cpulimit -e firefox -l 30

No caso, para limitar você precisa saber o numero PID(processo) do firefox no meu sistema.

$ ls -la (vê todos os processos)
ou
$ ps aux | less
$ ps aux | grep firefox

Agora com o PID em mãos, limite o processo.

$ sudo cpulimit -p 1313 -l 30

Você pode também limitar usando o caminho do programa, se você souber.

$ cpulimit -P /opt/firefox/firebox -l 30

Explicação:
* -p : processo PID.  (http://en.wikipedia.org/wiki/PID_controller)
* -e : nome do processo.
* -l : percentagem permitida do processador (vai de 0 a 100)
* -P: nome do caminho absoluto do executável do programa.

Mais informações em : http://cpulimit.sourceforge.net/

ps. Thx ao António Moreira pela dica.

Fortunes no console

Posted by Allen Franco | Posted in Ubuntu | Posted on 18-06-2009

0

Algumas mensagens e mensagens ANSII  divertidas são a parada com o Fortune.

pi               --==>>  THE COMPLETE GUIDE TO COWS  <<==--

                    as you've NEVER seen them before!

            (__)                     )__(                vv    vv
            (oo)                     (oo)                ||----||  *
     /-------\/               *-------\/                 ||     | /
    / |     ||               / |     ||                 /\-------/
   *  ||----||              /  ||----||                (oo)
      ^^    ^^                 vv    vv                (~~)

   American Cow              Polish Cow            Australian Cow

Instala o fortune em pt-BR
$ sudo aptitude install fortunes-br

Configura o arquivo de configuração do console
$ sudo vim .bashrc

Agora é só adicionar na última linha

fortune

E os Furtunes começarão a aparecer :-)

sources.list do ubuntu 9.04

Posted by Allen Franco | Posted in Ubuntu | Posted on 18-06-2009

0

Pra quem usa o Ubuntu 9.04 (Jaunty) e fez caca na sources.list, segue a minha:

# deb cdrom:[Ubuntu 9.04 _Jaunty Jackalope_ - Beta i386 (20090324)]/ jaunty main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty main restricted
deb-src http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty-updates main restricted
deb-src http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty universe
deb-src http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty universe
deb http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty-updates universe
deb-src http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty multiverse
deb-src http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty multiverse
deb http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty-updates multiverse
deb-src http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty-updates multiverse

## Uncomment the following two lines to add software from the ‘backports’
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://br.archive.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse
# deb-src http://br.archive.ubuntu.com/ubuntu/ jaunty-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical’s
## ‘partner’ repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu jaunty partner
# deb-src http://archive.canonical.com/ubuntu jaunty partner
# Até aqui não adicionei nada!

# Mediubuntu
# w32codecs principalmente :) – https://help.ubuntu.com/community/Medibuntu
deb http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty-security main restricted
deb-src http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty-security main restricted
deb http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty-security universe
deb-src http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty-security universe
deb http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty-security multiverse
deb-src http://www.las.ic.unicamp.br/pub/ubuntu/ jaunty-security multiverse
deb http://download.virtualbox.org/virtualbox/debian intrepid non-free

# Banshee – Uma ótima alternativa ao rhythmbox
deb http://ppa.launchpad.net/banshee-team/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/banshee-team/ppa/ubuntu jaunty main

##Themes du ZgegBlog: Project Bisigi
# pacote de temas obrigatório :) – “apt-get install zgegblog-theme”
deb http://ppa.launchpad.net/bisigi/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/bisigi/ppa/ubuntu jaunty main

# Google
deb http://dl.google.com/linux/deb/ stable non-free
deb http://dl.google.com/linux/deb/ testing non-free

# gNote
# port em c++ do tomboy, mas ainda tem que melhorar mais
deb http://ppa.launchpad.net/gnote/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/gnote/ppa/ubuntu jaunty main

Para usar, basta você entrar no console e seguir os passos:

$ sudo gedit /etc/apt/sources.list

Depois de editar o arquivo, apagar tudo nele e colar a listagem acima dentro, salvando e fechando o arquivo você volta pro console.

$ sudo aptitude update

Este comando irá atualizar todas as suas fontes e mostrar alguns arquivos para atualizar.