Skip to content

Jonas Silveira

o blog de um cientista da computação

Archive

Category: Linux

Just use the split command:

split --bytes=1G large_file_name short_dir/short_file_prefix_

This will create a lot of files with 1 G in short_dir. The files will named short_file_prefix_aa, short_file_prefix_ab, short_file_prefix_ac …

Found in Techie Corner.

Facebooktwitterredditpinterestlinkedinmail

Find files and save a text file named “script.sh”:

find . | xargs grep -l "text string here" | awk '{print "rm "$1}' > script.sh

Then chmod +x the file and run. Solution found in Stack Overflow.

Facebooktwitterredditpinterestlinkedinmail

Just use the smart_host:

1. Edit your  /etc/mail/sendmail.mc

2. Add a line like this:

define(`SMART_HOST', `smtp.your.provider')dnl

3. Apply the changes:

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

Then restart the service.

Facebooktwitterredditpinterestlinkedinmail

In Fedora 17, if you turn your WLAN off using the Gnome menu, you may “soft block” your device. The result is that you can’t activate it.

To solve, just install rfkill, an thendo the unblock command.

yum install rfkill

rfkill unblock all

You also can type “rfkill list” to see if your Fedora is blocking some device.

Facebooktwitterredditpinterestlinkedinmail

I tested under Fedora 15 and CentOS 5.4 and it works fine, using FreeTDS!

Easy steps:

1. Install unixODBC and freetds:

yum install freetds unixODBC

2. Configure unixODBC to use FreeTDS adding the following code to your /etc/odbcinst.ini file (check the red lines, because the files can change):

[FreeTDS]
Description        = ODBC for FreeTDS
Driver        = /usr/lib/libtdsodbc.so
Setup        = /usr/lib/libtdsS.so.2
Driver64        = /usr/lib64/libtdsodbc.so
Setup64        = /usr/lib64/libtdsS.so.2
FileUsage        = 1
UsageCount        = 1

[ODBC Drivers]
FreeTDS = Installed

3. Create your DSN into /etc/odbc.ini file:

[connection_name]
Driver = /usr/lib64/libtdsodbc.so
Description = My Connection Name
Trace = No
Server = 192.168.0.3
Port = 1433
UID = sql_username_here
Password = sql_password_here
Database = DATABASE_NAME_HERE

[ODBC Data Sources]
connection_name = FreeTDS

4. Test your configuration:

isql -v connection_name sql_username_here sql_password_here

The result will be something like:

+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>

5. Install PHP-ODBC:

yum install php-5.2-odbc-zend-server.x86_64

6. Finally create your PHP Script:

<?php

putenv ( 'ODBCINI=/etc/odbc.ini' );
putenv ( "ODBCINSTINI=/etc/odbcinst.ini" );

$conn = odbc_connect ( 'connection_name', 'sql_username_here', 'sql_password_here' ) or die ( 'Error: ' . odbc_error () );
if (! $conn) {
    die ( 'Connection error' );
}

$sql = "SELECT * FROM INFORMATION_SCHEMA.TABLES";
$res = odbc_exec ( $conn, $sql );
odbc_result_all ( $res );

odbc_close ( $conn );

Easy!

Facebooktwitterredditpinterestlinkedinmail

I installed Fedora 15 x86_64 on Vaio VPCCW21FX (Intel I3). It works fine!

  1. Install Fedora using DVD (x66_64);
  2. Do the yum updates (about 457 Mb);
  3. Disable SELINUX (edit /etc/sysconfig/selinux);
  4. Install mesa-dri-drivers;
  5. Reboot;
  6. Install kernel-headers kernel-devel gcc using yum;
  7. Download latest Compat-Wireless here and install it. After uncompress, run:
    make
    make install
    make unload
    make wlunload
    make btunload
    modprobe ath9k
  8. Install Flash 64 bits (preview release). Instructions here;
  9. Install gnome-tweak-tool.noarch
  10. Install new repos:
    rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
    http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm
  11. Give a look at:
    The Perfect Desktop – Fedora 15 (be careful, it’s a guide for 32 bits)
  12. I installed some tools I use to work (needs to create zend repo under yum.repos.d):
    yum install httpd mysql mysql-server php-5.2-mysql-zend-server php-5.2-mcrypt-zend-server php-5.2-bcmath-zend-server php-5.2-curl-zend-server php-5.2-mysqli-zend-server php-5.2-mbstring-zend-server php-5.2-imap-zend-server php-5.2-zip-zend-server php-5.2-dev-zend-server mod-php-5.2-apache2-zend-server php-5.2-gd-zend-server php-5.2-extension-manager-zend-server php-5.2-ftp-zend-server php-5.2-tokenizer-zend-server php-5.2-pdo-mysql-zend-server php-5.2-debugger-zend-server php-5.2-ctype-zend-server php-5.2-wddx-zend-server zend-server-ce-php-5.2.noarch git subversion meld kdesvn
  13. Install multimedia tools:
    yum install xmms-mp3.x86_64 xmms-normalize.x86_64 xmms-mplayer.x86_64 gnome-mplayer.x86_64 gnome-mplayer-nautilus.x86_64
  14. Install other tools… The most important is Compat-Wireless and Mesa Video Drivers.
Facebooktwitterredditpinterestlinkedinmail

O ProFTPD possui um módulo disponível no EPEL pronto para isso, inclusive com controle de quota.

Tutorial: http://heker86.wordpress.com/2008/10/21/how-to-install-and-configure-proftpd-with-integrate-the-mysql/

Observação: Nesse tutorial é usado SQLHomedirOnDemand,que não existe mais. Considere o comando CreateHome.

Para um log mais completo dos acessos, alterei o engine para InnoDB, criei uma tabela com o log dos acessos, e uma trigger que a alimenta automaticamente:

CREATE TABLE `ftpaccesslog` (
 `access_id` int(10) NOT NULL auto_increment,
 `userid` varchar(32) NOT NULL,
 `data_acesso` date NOT NULL,
 `hora_acesso` time NOT NULL,
 PRIMARY KEY  (`access_id`),
 KEY `userid` (`userid`),
 KEY `data_acesso` (`data_acesso`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
DELIMITER //
CREATE TRIGGER tr_acces_log AFTER UPDATE ON ftpuser
  FOR EACH ROW BEGIN
  IF NEW.count > OLD.count THEN
    INSERT INTO ftpaccesslog (userid, data_acesso, hora_acesso) 
    VALUES (NEW.userid, NOW(), NOW());
  END IF;
END;
//
DELIMITER ;

Site do projeto: http://www.proftpd.org/docs/howto/SQL.html

Facebooktwitterredditpinterestlinkedinmail

Comigo aconteceu por culpa do ZendServer.

Para corrigir (encontrado em http://forums.zend.com/viewtopic.php?f=44&t=8130):
Editar /etc/ld.so.conf.d/zend_server.conf adicionando a primeira linha:

/usr/lib64 /usr/local/zend/lib

Depois disso, execute o comando ldconfig e pronto.

Facebooktwitterredditpinterestlinkedinmail

Quando um caminho NFS fica indisponível, isso causa uma série de problemas nos clients. Primeiro você não consegue desmontar a unidade pela forma convencional. Segundo, alguns comandos que possam utilizar tal caminho mapeado não irão rodar, inclusive aqueles que ficam agendados no cron, como o updatedb. O resultado isso é uma série de processos rodando que não têm fim.

No meu caso, consegui desmontar utilizando o comando:

umount -f -l /mnt/nfsfolder

Alguns dizem que se você não conseguir, deverá antes configurar um ip virtual igual ao IP do extinto servidor. Seria algo do tipo:

ifconfig eth0:nfstmp 192.168.0.30/24
Facebooktwitterredditpinterestlinkedinmail

Pode procurar esses icones para adicionar ao Painel que você não vai encontrar. Basta adicionar o “Notification Area”, que esses icones todos fazem parte dela.

Facebooktwitterredditpinterestlinkedinmail