UNIX NetWork

SoftwareDecember 15, 2011 12:26 am

Si alguno quiere venir en pos de mi, nieguese a si mismo, y tome su cruz, y sigame. Porque todo el que quiera salvar su vida, la perdera; y todo el que pierda su vida por causa de mi, la hallara. Porque ¿que aprovechara al hombre, si ganare todo el mundo, y perdiere su alma? ¿O que recompensa dara el hombre por su alma?
Mateo 16:24-26

Software, MandrivaSeptember 12, 2010 6:48 pm

download the opera package for mandriva

http://www.opera.com/browser/download/

$ tar -xzvf opera-10.62-6438.i386.linux.tar.gz
$ cd opera-10.62-6438.i386.linux/
$ ./install

Opera has been installed successfully. To start, run /home/user/.local/bin/opera (you might want to add this location to your PATH).

To manage installed Opera Widgets, run /home/user/.local/bin/opera-widget-manager.

thats it, enjoy

Software, Google Phone 1:00 am


Here is a picture of what it will be The Google Phone Like, i will run Linux as OS, i hope it gets here soon, i will buy one for sure.

Software, MandrivaSeptember 6, 2010 11:14 pm

you just need to type

$ drakuser

type your root password and a window will open, thats it.

MuzikSeptember 4, 2010 4:30 pm


Software, Command Line, rsyncSeptember 2, 2010 4:24 pm

Backup de directorios y ficheros

Se trata de hacer un backup de todos los archivos de nuestro usuario. A demás, mantendremos un histórico de backups, haremos una copia diaria (lunes, martes, miércoles, etc .), cada lunes machacaremos la copia del lunes anterior y así con todos los días.

El procedimiento es sencillo, elegiremos los directorios y ficheros de los que queremos hacer el backup, y los copiaremos.

cp -rp ~/banyut /media/sdb5/backup/domingo

Es totalmente funcional, pero la verdad es que no es eficiente, el problema está en que cada lunes nos hará una copia completa de todos los archivos que tenemos en el directorio, cuando lo que seria deseable es que solo copiara los modificados o los creados des del último backup.

No hay problema, tenemos otra instrucción que nos ofrece esta funcionalidad.

rsync -altgvbp /home/banyut /media/sdb5/backup/domingo

Hoy no explicaré el comando rsync ni sus opciones, si alguien tiene alguna duda primero que consulte “man rsync” y después que pregunte.

Bueno, ya tenemos la instrucción que nos permite poder realizar nuestra copia. El siguiente paso es que estas se realicen de manera automática, para ello utilizaremos otra instrucción que nos ofrece el sistema crontab.

Crontab nos permite ejecutar aplicaciones en un momento determinado, una única vez o de manera recurrente. En un principio puede parecer algo liosa pero en realidad es muy fácil de usar.

crontab -e

Esta instrucción nos permite editar el archivo /etc/crontab, en el que programaremos las instrucciones que queremos ejecutar.

Cada linea de este archivo esta formada por 7 columnas

1. Minutos (de 0 a 59)
2.

Horas (de 0 a 23)
3.

Dia (de 1 a 31)
4.

Mes (de 1 a 12)
5.

Dia de la semana (de 0 a 7, donde 0 o 7 es domingo)
6.

usuario (opcional)
7.

orden a ejecutar

Un asterisco en cualquiera de las primeras 5 columnas indica todos, es decir si queremos que algo se ejecute todos los meses en la columna del mes podremos un asterisco.

En realidad es un poco mas complejo pero por el momento ya nos vale así.

Como funcionan estas columnas.

5 * * * * se ejecutara el minuto 5 de cada hora todos los días.

0 2 * * * a las 2:00H en punto cada día.

0 2 * * 0 a las 2:00h todos los domingos del año.

* 5 * * 1 todos los minutos de las 5:00 a 5:59 de todos los lunes.

2 * 10 4 * el minuto dos de cada hora el dia 10 de abril de cada año.

0 3 * * 6 a las 03:00 horas de todos los sábados

En cada una de estas columnas podemos poner más de un valor, o incluso un rango, esto se hace separando cada valor mediante una coma o un rango mediante un guión.

Así en la columna día de la semana podemos poner 1,3,5 que indicara que se ejecute los lunes, miércoles y viernes. O en la columna mes para indicar la primera quincena podemos poner 1-15.

Esto aún podemos complicarlo un pelín más, tenemos otra operación el símbolo “/”, que indica un incremento, por ejemplo, si en la columna minutos ponemos */15 se ejecutará cada 15 minutos, o si en la columna dias ponemos 1-10/2, se ejecutará los dias 1,3,5,7 y 9.

Por último un ejemplo más complejo.

0 */2 1-15,23,28-31 * 0,6

Se ejecutara cada dos horas los días 1 al 15,el 23, 28, 29, 30 y 31 de todos los meses pero solo cuando sean sábado o domingo.

Ala, como se os ha quedado el cuerpo!!!!

Sabiendo esto, ahora podremos conseguir que nuestros backups se ejecuten de manera automática.

Después de teclear crontab -e añadiremos las siguientes lineas.

0 1 * * 0 instrucción_lunes

0 1 * * 1 instrucción_martes

0 1 * * 2 instrucción_miercoles

0 1 * * 3 instrucción_jueves

0 1 * * 4 instrucción_viernes

0 1 * * 5 instrucción_sabado

0 1 * * 6 instrucción_domingo

Con esto conseguiremos que se ejecute cada día a las 01:00 horas las instrucciones indicadas. Podemos substituir “instrucción_******” por la orden rsync arriba descrita.

De todas formas lo haremos un pelín más completo, crearemos un script para cada día de la semana, además recogeremos un log.

Empezaremos creando los directorios necesarios.

mkdir ~/.crono_bak

cd ~/.crono_bak

Dentro del directorio que acabamos de crear, crearemos siete ficheros mas llamados lunes.sh, martes.sh, …, domingo.sh y en su interior pondremos lo siguiente.

#!/bin/bash

pathLog=”/media/sdb5/backup/logLunes.log”

echo ———————————————————————– >> $pathLog

echo —INICI COPIA SEGURETAT LUNES >> $pathLog

date >> $pathLog

echo ———————————————————————– >> $pathLog

echo — Iniciem Sincronització directori /home/monti >> $pathLog

rsync -altgvb /home/monti /media/sdb5/backup/sistema/lunes >> $pathLog

echo ———————————————————————– >> $pathLog

echo — Sincronització Finalitzada >> $pathLog

date >> $pathLog

echo ———————————————————————– >> $pathLog

Este código es el que corresponde al script del lunes, para los otros seis haremos lo mismo pero substituyendo Lunes por el día de la semana concreto.

El script ejecuta la instrucción rsync, el resto de las lineas lo que hacen es generar un fichero log.

Una vez creados los siete ficheros, tendremos que darles permiso para poder ejecutarlos.

chmod +x *.sh

Para que se ejecute todos los dias a la 1 de la mañana, nuestro crontab quedará así.

# m h dom mon dow command

0 1 * * 1 /home/banyut/.crono_back/lunes.sh >>/media/sdb5/backup/logcrono.log

0 1 * * 2 /home/banyut/.crono_back/martes.sh >>/media/sdb5/backup/logcrono.log

0 1 * * 3 /home/banyut/.crono_back/miercoles.sh >>/media/sdb5/backup/logcrono.log

0 1 * * 4 /home/banyut/.crono_back/jueves.sh >>/media/sdb5/backup/logcrono.log

0 1 * * 5 /home/banyut/.crono_back/viernes.sh >>/media/sdb5/backup/logcrono.log

0 1 * * 6 /home/banyut/.crono_back/sabado.sh >>/media/sdb5/backup/logcrono.log

0 1 * * 0 /home/banyut/.crono_back/domingo.sh >>/media/sdb5/backup/logcrono.log

Por su puesto, la ruta /media/sdb5/backup/sistema/ tiene que existir y en su interior tiene que haber 7 directorios llamados lunes, martes, etc.

bueno, ya se que el script es muy mejorable y que se podria haber hecho con un solo fichero en vez que con siete, pero creo que para empezar ya esta bien así.

Para poder revisar nuestra programación ejecutaremos:

crontab -l

He dado por hecho que el demonio cron esta activado, para comprobar esto podemos ejecutar.

ps -ef | grep crontab

En caso que no este en marcha lo iniciaremos de la siguiente forma

sudo /etc/init.d/cron start

Por último para ver si se ha ejecutado bien podemos mirar el log que hemos creado en /media/sdb5/backup/logcrono.log podemos mirar los logs del dia en concreto dentro de la carpeta /media/sdb5/backup/*****.log,tambien podemos ver cuando se ha ejecutado nuestro crontab consultando el log del systema.

cat /var/log/syslog |grep crontab

Software, NetBSDAugust 27, 2010 2:48 pm

TriTeal’s TED 4.0 product (basically,
TriTeal’s port of CDE) running under NetBSD/SPARC 1.2.1, using their SunOS
distribution:

netbsd4me:1:144 % uname -a
NetBSD netbsd4me 1.2.1 NetBSD 1.2.1 (NETBSD4ME) #4: Fri Mar 28 01:03:11 PST 1997 earle@netbsd4me:/usr/src/1.2.1/sys/arch/sparc/compile/NETBSD4ME sparc

netbsd4me:1:145 % ps -axww | egrep ‘PID|dt|tts’
PID TT STAT TIME COMMAND
4199 ?? S 0:32.04 /usr/X11R6.1/bin/X :0 -auth /var/dt/Anetbsd4me:0-a00165 (Xsun)
4200 ?? I 0:00.08 /usr/dt/bin/dtlogin
4228 ?? I 0:01.66 /usr/dt/bin/dtsession
4261 ?? S 0:00.60 /usr/dt/bin/dsdm
4262 ?? I 0:00.65 /usr/dt/bin/ttsession -s
4276 ?? S 0:07.10 dtwm
4277 ?? I 0:03.36 dtfile
4279 ?? I 0:01.79 /usr/dt/bin/dthelpview
4283 ?? I 0:00.46 dtfile
4296 ?? I 0:00.17 /usr/dt/bin/dtexec -open 0 -ttprocid 2.pF7jB 01 4262 1342177295 1 0 1074 128.149.24.252 3_102_1 /usr/dt/bin/dtterm
4297 ?? S 0:24.72 /usr/dt/bin/dtterm
165 co- I 0:02.02 /usr/dt/bin/dtlogin

I figured I had a better chance of getting this to work with SunOS binaries
than if I’d tried the Solaris 2.5.1 CDE 1.0.2 stuff …

Getting this running was, uh, an “interesting exercise”

My /emul/sunos/etc directory now has a few more things in it as a result
of this. The CDE login widget thingie demanded to see a SunOS-style readable
passwd file, so I had to copy /etc/master.passwd to /emul/sunos/etc/passwd
and edit it a bit. Something else wanted a SunOS-style utmp file so
/emul/sunos/etc/utmp became a symlink to /var/run/utmp. The ToolTalk database
server (rpc.ttdbserverd) wanted to see a SunOS-style /etc/mtab file, so I
copied /etc/fstab to /emul/sunos/etc/mtab and added “,dev=NNN” entries where
appropriate. Of course “dtterm” wanted a termcap entry, so /emul/sunos/etc
got a “termcap” symlink to /usr/share/misc/termcap. And so on and so forth …
(Maybe some of these could be added to compat_sunos(8) … )

Anyway, if anyone cares, you can get a 30-day eval. CD-ROM from TriTeal, and
I can help with any specific questions about it … I had to modify a few of
the scripts that come with TED as they’re looking in SunOS-specific places for
certain things (like grep, chown, chmod, etc.). (It would also be cool if
someone wrote an “lpstat” for NetBSD, because the CDE printer stuff wants to
use “lpstat -t” and since that doesn’t exist, all the Print Manager stuff
doesn’t work - claims there’s no printers.)

thanks to Greg

Software, NetBSDAugust 23, 2010 2:49 pm

Introduction

Here’s how to install NetBSD from a USB Stick

Get the sets
Choice 1) copy the CDrom
Get and mount the install ISO (ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/iso/),
vnconfig -c vnd0 i386cd-5.1_RC3.iso
mkdir -p iso
mount_cd9660 /dev/vnd0d `pwd`/iso

Copy the CDrom installation media and unmount,
#rm -f netbsd-5.1rc3-install.img
#rm -rf inst
cp -R iso inst
umount iso
rmdir iso
vnconfig -u vnd0

Fix the boot loader,
cd inst
#cp -f /usr/mdec/boot .
mv boot.cfg boot.cfg.dist
sed ’s/installation CD/installation memory stick/’ boot.cfg.dist > boot.cfg
rm -f boot.cfg.dist
cd ..

Choice 2) fetch the stuff
Fetch the installation kernel and miniroot module,
#rm -f netbsd-5.1rc3-install.img
#rm -rf inst
mkdir -p inst/i386/binary/sets
cd inst
ftp -a ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/kernel/netbsd-GENERIC.gz
ftp -a ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/installation/miniroot/miniroot.kmod
mv netbsd-GENERIC.gz netbsd
Note. there’s also netbsd-INSTALL_FLOPPY.gz but it’s not like we don’t have enought space on an USB stick. We simply use netbsd-GENERIC.gz even for installation : the miniroot module makes it happy happy

Fetch the needed sets,
cd i386/binary/sets
ftp -a ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/base.tgz
ftp -a ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/comp.tgz
ftp -a ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/etc.tgz
ftp -a ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/kern-GENERIC.tgz
ftp -a ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/man.tgz
ftp -a ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/misc.tgz
ftp -a ftp.fr.netbsd.org/pub/NetBSD/NetBSD-5.1_RC3/i386/binary/sets/text.tgz
cd ../../..

Configure the boot loader,
cp -f /usr/mdec/boot .
cat > boot.cfg < banner=PWET PWET YOUPLA BOOM
menu=Install NetBSD:load /miniroot.kmod;boot netbsd
menu=Install NetBSD (no ACPI):load /miniroot.kmod;boot netbsd -2
menu=Install NetBSD (no ACPI, no SMP):load /miniroot.kmod;boot netbsd -12
menu=Drop to boot prompt:prompt
timeout=10
EOF9
cd ..

Make the USB image
Build the image and make it bootable,
makefs netbsd-5.1rc3-install.img inst
installboot netbsd-5.1rc3-install.img /usr/mdec/bootxx_ffsv1

Write the BSD label to the image,
imgsize=$(stat -L -f %z netbsd-5.1rc3-install.img)
cat < sed "s/@SECTORS@/$(expr $imgsize / 512)/" | \
sed "s/@TCYLINDERS@/$(expr $imgsize / 512 / 1000 + 1)/" | \
sed "s/@TSECTORS@/$(expr $imgsize / 512 + 1)/" > disklabel.tmp
type: unknown
disk: Memory Stick
label:
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1000
cylinders: @TCYLINDERS@
total sectors: @TSECTORS@
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0
track-to-track seek: 0
drivedata: 0

16 partitions:
a: @SECTORS@ 0 4.2BSD 1024 8192 0
d: @SECTORS@ 0 unused 0 0
EOF9
disklabel -R -F netbsd-5.1rc3-install.img `pwd`/disklabel.tmp

Clean up,
unset imgsize
rm -f disklabel.tmp
rm -rf inst

Ready to go
Write the image to an USB stick. On NetBSD,
dd if=netbsd-install.img of=/dev/rsd1d bs=1m
on Linux,
dd if=netbsd-install.img of=/dev/sd1 bs=1m
on Windows, use “HP Drive Key Boot Utility” or “DD for Windows”,
dd –list
dd if=netbsd-install.img of=\\?\Device… bs=1M –progress

You can now use the USB stick to install NetBSD (i386 or amd64).

References
ftp.netbsd.org/pub/NetBSD/misc/jmcneill/mkmemstick.sh

Software, Old TimesAugust 22, 2010 8:02 pm

Remembering old times..


In 1995 Internet access providers as Compuserve, Aol and Prodigy all started business.


Yahoo 1995


Red Hat 1995

Software, NetBSD, Mutt 7:26 pm

Introduction

The mutt is not just an email client, it is also very useful in bash script. mutt’s CLI (command line interface) parameter can be called and execute without starting the email client interactively, ideal to run it within bash script to send email. mutt is also able to control from config file, ~/.muttrc, with a rich feature set waiting to harness.

This guide is focused on getting mutt up and running with your Gmail provider through its IMAP API and provides some keybindings to make the daily use easier.
We will look at how to recieve and sending email with mutt.

installation

cd /usr/pkgsrc/mail/mutt
make install clean

Configuration

Normally the default settings are fine to start with.

If you want to alter something, just put it in the configuration file that controls it all ~/.muttrc.

You can find the syntax for these configurations in the muttguide: http://wiki.mutt.org/index.cgi?MuttGuide
Setting up IMAP

Create ~/.muttrc in your preferred editor

$EDITOR ~/.muttrc

First we have to tell mutt who you are, put the following in your .muttrc

set from = “yourusername@gmail.com”
set realname = “Your Real Name”

Then mutt has to know where your gmail mailbox is and what your password is. You can safely put your password in here, we will cover this later.

set imap_user = “yourusername@gmail.com”
set imap_pass = “yourpassword”

Remember when running mutt for the first time, a certificate will be downloaded and you will be asked if you want to keep it. Just type Yes.
Setting up folders

The following lets mutt recognize your gmail folders (labels) and your local folders. Remember that sent messages goes to your Sent Mail folder on the gmail server pr. default, so no actions needs to be done here.
Remote folders

set folder = “imaps://imap.gmail.com:993″
set spoolfile = “+INBOX”
set postponed =”+[Gmail]/Drafts”
set trash = “imaps://imap.gmail.com/[Gmail]/Trash”

Local folders

Paste this in your ~/.muttrc

set header_cache =~/.mutt/cache/headers
set message_cachedir =~/.mutt/cache/bodies
set certificate_file =~/.mutt/certificates

Now, create the 2 folders, the 3 lines above are referred to

mkdir .mutt
mkdir .mutt/cache

Setting up SMTP

Here you would specify the url and password to gmail’s SMTP server.

set smtp_url = “smtp://yourusername@smtp.gmail.com:587/”
set smtp_pass = “yourpassword”

Special keybindings

The keybindings below shows mutt that pressing ie. “gi” (the letter g followed by the letter i) means “go to inbox”.

bind editor noop
macro index gi “=INBOX” “Go to inbox”
macro index ga “=[Gmail]/All Mail” “Go to all mail”
macro index gs “=[Gmail]/Sent Mail” “Go to Sent Mail”
macro index gd “=[Gmail]/Drafts” “Go to drafts”

Don’t put spaces between

the folder name as Mutt will complain that it cannot find the mailbox.
Secure your muttsession

These lines will help you preventing some minor annoyances.

set move = no #Stop asking to “move read messages to mbox”!
set imap_keepalive = 900

Now save the file .muttrc in your /home directory. To be sure that only your username can access the file you’ll have to give the file a proper permission.

Type this in your terminal

chmod 700 .muttrc

Some extra stuff

This is parts from my .muttrc (just to get you going). Please read the muttguide: http://wiki.mutt.org/index.cgi?MuttGuide for explanations!

# Header stuff
ignore “Authentication-Results:”
ignore “DomainKey-Signature:”
ignore “DKIM-Signature:”
hdr_order Date From To Cc

ignore *
unignore from: date subject to cc
unignore x-mailing-list: posted-to:
unignore x-mailer:

# For better looks
set markers=no # don’t put ‘+’ at the beginning of wrapped lines
set pager_index_lines= 5 # how large is the index window?
set sort = ‘threads’
set sort_aux = ‘last-date-received’

# My Editor
set editor=’vim + -c “set textwidth=72″ -c “set wrap” -c “set nocp” -c “?^$”‘

# My Rolodeck :)
set alias_file= ~/.mutt/aliases
set sort_alias= alias
set reverse_alias=yes
source $alias_file