ETL
BANCO DE CARGA - DWC01
@sysdba_carga;
@set;
select sysdate from dual;
exec dwadm1.grant_automatico_total_01;
exec dwadm.drop_create_synonyms;
select sysdate from dual;
ESQUEMA ETCG
grant execute on pk_critica_movimento to pgto, pgto_opr;
grant execute on obj_valid_dimensao to pgto, pgto_opr;
grant execute on PK_TRATA_ERRO_CARGA to pgto, pgto_opr;
ESQUEMA PGTO_OPR
@dw_movimento_5801_apo.sql;
@dw_movimento_5802_apo.sql;
@dw_movimento_5803_apo.sql;
@dw_movimento_5804_apo.sql;
ESQUEMA PGTO
@C:\_TemasDW\pgto\DWC01\dw_movimento_erro_5801_apo.sql
@C:\_TemasDW\pgto\dwc01\Dw_movimento_erro_5802_apo.sql
@C:\_TemasDW\pgto\dwc01\dw_movimento_erro_5803_apo.sql
@C:\_TemasDW\pgto\dwc01\dw_movimento_erro_5804_apo.sql
@C:\_TemasDW\pgto\dwc01\Pk_Dimensiona_5801.sql
@C:\_TemasDW\pgto\dwc01\Pk_Dimensiona_5802.sql
@C:\_TemasDW\pgto\dwc01\Pk_Dimensiona_5803.sql
@C:\_TemasDW\pgto\dwc01\Pk_Dimensiona_5804.sql
@C:\_TemasDW\pgto\dwc01\Pk_Carga_5801.sql
@C:\_TemasDW\pgto\dwc01\Pk_Carga_5802.sql
@C:\_TemasDW\pgto\dwc01\Pk_Carga_5803.sql
@C:\_TemasDW\pgto\dwc01\Pk_Carga_5804.sql
-- Indice para redundancia com as fatos WF_PGTO e WF_PGTO_APGT
@C:\_TemasDW\pgto\dwc01\I_WF_PGTO.ind
@C:\_TemasDW\pgto\dwc01\I_WF_PGTO_APGT.ind
---- 5801
ftp (modelo de solicitação):
Enviar para CAS com cópia para CDSPCTM@correiolivre.serpro.gov.br
Solicitamos transferência dos arquivos abaixo relacionados para o nó 39.
Obs.: Os arquivos contem textos acentuados. Utilizar a opcao site charset(sw88591) no ftp.
DSN do Arquivo Nome no Nó 39 Endereço no nó 39
F.K21880P1.D80414.PGTO01 F.&21880nn.T58xxnn.Oymmdd0.Gyymmdd.DAT /dwed_01/dw/pgto/dados
xx=arquivo
nn=seqüência
Oymmdd0 = data de arrec. final
Gyymmdd = data da extração
Agendamento Unix com comando "at"
Neste exemplo, o arquivo /dwed_01/dw/pgto/etl contem a listagem de
comandos que serao rodados
Sintaxe:
pgto_opr>at --help
Usage: at [-c|-k|-s|-q {a|b|{e-z}}] [-m] [-f File] Time [Day] [Increment]
Usage: at [-c|-k|-s|-q {a|b|{e-z}}] [-m] [-f File] -t [[CC]YY]MMDDhhmm[.SS]
Usage: at -l [-v] [-o] [ JobNumber... | -q {a|b|{e-z}} ]
Usage: at -r [-Fi] JobNumber ... [-u User]
Usage: at -n [User]
Definindo o job (-f =file, -t=horário do job):
rspop1p02 - dwc01a - /dwed_01/dw/pgto - 473 - (-ksh)
pgto_opr>at -f /dwed_01/dw/pgto/etl -t 200803180100.00
Job pgto_opr.1205812800.a will be run at Tue Mar 18 01:00:00 GRNLNDST 2008.
Verificando o job agendado (-l = list, -v = verbose):
rspop1p02 - dwc01a - /dwed_01/dw/pgto - 476 - (-ksh)
pgto_opr>at -lv
========================
pgto_opr.1205812800.a Tue Mar 18 01:00:00 GRNLNDST 2008
========================
/dwed_01/dw/pgto/etl
opub_acum_loader_v3.sh 58 01 801010 080213;
opub_acum_dim.sh 58 01 2000 01 02;
opub_acum_carga.sh 58 01 2000 01 01;
--- disable constraint
ALTER TABLE .... DISABLE CONSTRAINT ....;
@\\10.14.53.30\pgto\scripts_fatos_dimensoes\WF_WD_PGTO_part.tab
@\\10.14.53.30\pgto\scripts_fatos_dimensoes\WF_WD_PGTO_part.ind
@\\10.14.53.30\pgto\scripts_fatos_dimensoes\WF_WD_PGTO_part.con
----
@\\10.14.53.30\pgto\dwc01\dw_movimento_erro_5801_apo.sql
@\\10.14.53.30\pgto\dwc01\dw_movimento_erro_5802_apo.sql
@\\10.14.53.30\pgto\dwc01\dw_movimento_erro_5803_apo.sql
@\\10.14.53.30\pgto\dwc01\dw_movimento_erro_5804_apo.sql
grant select, update, delete, references, insert on DW_MOVIMENTO_erro_5801_APO to etcg;
grant select, update, delete, references, insert on DW_MOVIMENTO_erro_5802_APO to etcg;
grant select, update, delete, references, insert on DW_MOVIMENTO_erro_5803_APO to etcg;
grant select, update, delete, references, insert on DW_MOVIMENTO_erro_5804_APO to etcg;
@\\10.14.53.30\pgto\dwc01\Pk_Dimensiona_5801.sql
@\\10.14.53.30\pgto\dwc01\Pk_Dimensiona_5802.sql
@\\10.14.53.30\pgto\dwc01\Pk_Dimensiona_5803.sql
@\\10.14.53.30\pgto\dwc01\Pk_Dimensiona_5804.sql
grant execute on Pk_Dimensiona_5801 to etcg, pgto_opr;
grant execute on Pk_Dimensiona_5802 to etcg, pgto_opr;
grant execute on Pk_Dimensiona_5803 to etcg, pgto_opr;
grant execute on Pk_Dimensiona_5804 to etcg, pgto_opr;
@\\10.14.53.30\pgto\dwc01\Pk_Carga_5801.sql
@\\10.14.53.30\pgto\dwc01\Pk_Carga_5802.sql
@\\10.14.53.30\pgto\dwc01\Pk_Carga_5803.sql
@\\10.14.53.30\pgto\dwc01\Pk_Carga_5804.sql
grant execute on Pk_Carga_5801 to etcg, pgto_opr;
grant execute on Pk_Carga_5802 to etcg, pgto_opr;
grant execute on Pk_Carga_5803 to etcg, pgto_opr;
grant execute on Pk_Carga_5804 to etcg, pgto_opr;
--- pgto_OPR
@dw_movimento_5801_apo;
@dw_movimento_5802_apo;
@dw_movimento_5803_apo;
@dw_movimento_5804_apo;
grant select, update, delete, references, insert on DW_MOVIMENTO_5801_APO to etcg,pgto;
grant select, update, delete, references, insert on DW_MOVIMENTO_5802_APO to etcg,pgto;
grant select, update, delete, references, insert on DW_MOVIMENTO_5803_APO to etcg,pgto;
grant select, update, delete, references, insert on DW_MOVIMENTO_5804_APO to etcg,pgto;
---- 5801
opub_acum_loader_v3.sh 58 01 709040 070904;
opub_acum_dim.sh 58 01 2006 01 01;
opub_acum_carga.sh 58 01 2006 01 01;
@\\10.14.53.30\pgto\dwc01\
@C:\_TemasDW\pgto\dw_movimento_5801_apo.sql
@C:\_TemasDW\pgto\dw_movimento_5802_apo.sql
@C:\_TemasDW\pgto\dw_movimento_5803_apo.sql
@C:\_TemasDW\pgto\dw_movimento_5804_apo.sql
@C:\_TemasDW\pgto\dw_movimento_erro_5801_apo.sql
@C:\_TemasDW\pgto\dw_movimento_erro_5802_apo.sql
@C:\_TemasDW\pgto\dw_movimento_erro_5803_apo.sql
@C:\_TemasDW\pgto\dw_movimento_erro_5804_apo.sql
@C:\_TemasDW\pgto\Pk_Dimensiona_5801.sql
@C:\_TemasDW\pgto\Pk_Dimensiona_5802.sql
@C:\_TemasDW\pgto\Pk_Dimensiona_5803.sql
@C:\_TemasDW\pgto\Pk_Dimensiona_5804.sql
@C:\_TemasDW\pgto\Pk_Carga_5801.sql
@C:\_TemasDW\pgto\Pk_Carga_5802.sql
@C:\_TemasDW\pgto\Pk_Carga_5803.sql
@C:\_TemasDW\pgto\Pk_Carga_5804.sql
@C:\_TemasDW\pgto\pgto_idxdim_5801.ind
@C:\_TemasDW\pgto\pgto_idxdim_5802.ind
@C:\_TemasDW\pgto\pgto_idxdim_5803.ind
@C:\_TemasDW\pgto\pgto_idxdim_5804.ind
EXEC PR_TAB_ROW_SIZE('PGTO_BC', 'DW_MOVIMENTO_5801_APO');
EXEC PR_TAB_ROW_SIZE('PGTO_BC', 'DW_MOVIMENTO_5802_APO');
EXEC PR_TAB_ROW_SIZE('PGTO_BC', 'DW_MOVIMENTO_5803_APO');
EXEC PR_TAB_ROW_SIZE('PGTO_BC', 'DW_MOVIMENTO_5804_APO');
EXEC PR_IND_ROW_SIZE('PGTO_BC', 'DW_MOVIMENTO_5801_APO');
EXEC PR_IND_ROW_SIZE('PGTO_BC', 'DW_MOVIMENTO_5802_APO');
EXEC PR_IND_ROW_SIZE('PGTO_BC', 'DW_MOVIMENTO_5803_APO');
EXEC PR_IND_ROW_SIZE('PGTO_BC', 'DW_MOVIMENTO_5804_APO');
-- Create sequence fato WF_PGTO
create sequence SQ_PGTO
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
cache 20;
-- Create sequence fato WF_PGTO_APGT
create sequence SQ_PGTO_APGT
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
cache 20;
-- Create sequence fato WF_PGTO_AREC
create sequence SQ_PGTO_AREC
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
cache 20;
-- Create sequence fato WF_PGTO_RECP
create sequence SQ_PGTO_RECP
minvalue 1
maxvalue 9999999999
start with 1
increment by 1
cache 20;
MAINFRAME
ROTINAS JCL
abend - mostra por que rotina parou
ndvr - Endevor
nat2 - lista library na produção
arqreal - traz arquivos da produção
if eq '' - filtra antes de arqreal
jclrot - scripts jcl
21 exec cobol
ROSCOE
off - sai do roscoe
who is [chave roscoe] - informa usuário
sub - submete job
dis - lista job
a j [job] - exibe resultado do job
d j n - libera área para mostrar outro job
PF12 - history
dis [job] [job number]
purge [job number]
ROSCOE LIBRARY
lib a * - mostra todos os membros da library
include /[chave roscoe]/
f [arquivo] & a - seleciona o arquivo e traz para a AWS
ROSCOE AWS (área de trabalho)
d - exclui linha
dd - exclui bloco (usar na linha inicial/final de uma faixa)
cc - marca bloco (usar na linha inicial/final de uma faixa)
a - insere bloco marcado
i - insere linha
imp dsn=projeto.grupo.tipo(membro)
exp dsn=projeto.grupo.tipo(membro)
ex.: C0000.BASELINE.PRO(MEMBER) contem SCL das baselines
save [nome] - salva
u * - update
copy [arquivo] [linha] insere arquivo na linha
d[linha] - exclui linha especificada
point line [linha] - vai para linha especificada
a [line] ,, - vai para linha especificada
set mode x - aceita maiúsculas e minúsculas
ROSCOE DSN
d - exclui membro
cm - compress apos exclusão (necessita exclusividade no data set)
al - aloca data set
como criar dsn particionado
> L PENDING
> DSN() SCRL FULL COLS 00001 00079
><...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....
ALLOCATE NEW DATA SET
DATA SET ===> S2150.O10295R3.D60630
VOLUMES ===> mbad01
UNIT NAMES ===> 3390
UNITS ===> trk (BLK, TRK, OR CYL)
PRIMARY ===> 50 (NUMBER OF ABOVE UNITS)
SECONDARY ===> (NUMBER OF ABOVE UNITS)
DIRECTORY ===> 50 (VALID FOR PDS DATA SETS ONLY)
DSORG ===> po
RECFM ===> fb
LRECL ===> 80
BLKSIZE ===> 800
KEYLEN ===>
EXPDT ===> MM/DD/YYYY
CATALOG ===> YES (Y,N)
como criar dsn sequencial
>
> DSN() SCRL FULL COLS 00001 00079
><...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....
ALLOCATE NEW DATA SET
DATA SET ===> S2150.DU04708.D60721
VOLUMES ===>
UNIT NAMES ===> 3390
UNITS ===> trk (BLK, TRK, OR CYL)
PRIMARY ===> 50 (NUMBER OF ABOVE UNITS)
SECONDARY ===> 50 (NUMBER OF ABOVE UNITS)
DIRECTORY ===> (VALID FOR PDS DATA SETS ONLY)
DSORG ===> ps
RECFM ===> fb
LRECL ===> 80
BLKSIZE ===> 800
KEYLEN ===>
EXPDT ===> MM/DD/YYYY
CATALOG ===> YES (Y,N)
ROTINAS NATURAL
calcdv - calcula dv
conspar - consulta parametrizada
UNIX/LINUX
EMACS
^K delete line from cursor
^Y insert buffer
^(space) (select text) ^W
^/ undo
^S, ^R search (forward/rewind)
^G out from line command
^L refresh
^X starts another command:
^C close emacs
^F open file
^S save file
^W save file as...
1 back to one frame
2 open a second frame
O go to anohter frame
^B list buffers
cabo de console:
- E220R/450R: cabo de rede
- Netra: cabo de roteador Cisco
habilitar serial (linux):
# Serial lines
#s1:12345:respawn:/sbin/agetty 9600 ttyS0 vt100
s2:12345:respawn:/sbin/agetty 9600 ttyS1 vt100
partition: fdisk,diskdruid
hardware:modprobe,conf.modules,insmod
network:256-netmask-2(broadcast,network address)=hosts,ifconfig
X Window:Xconfigurator,XF86Setup,xf86config,xdm,window manager
create a boot disk:mkboot
network (solaris):
sys-unconfig ou configurar nic:
configurar /etc/hostname.hme1, /etc/netmasks e /etc/hosts
route add net 10.24.0.0 255.255.252.0 10.24.8.254 (solaris 2.6)
route add net 10.24.0.0/22 10.24.8.254 (solaris 8)
# Force hme1 to 100 full Duplex
ndd -set /dev/hme instance 1
ndd -set /dev/hme adv_100T4_cap 0
ndd -set /dev/hme adv_100fdx_cap 1
ndd -set /dev/hme adv_100hdx_cap 0
ndd -set /dev/hme adv_10fdx_cap 0
ndd -set /dev/hme adv_10hdx_cap 0
ndd -set /dev/hme adv_autoneg_cap 0
echo HME1 is set to 100Mbit Full Duplex
network (linux):
/sbin/ifconfig eth1 10.24.9.85 netmask 255.255.248.0
/sbin/ifconfig eth1 10.24.9.88 broadcast 10.24.15.255 netmask 255.255.248.0
route add -net 10.24.0.0 netmask 255.255.252.0 gw 10.24.8.254
editar lilo.conf
# Force eth0/eth1 to be 100Mbps Full-Duplex
append="ether=0,0,0x30,eth0 ether=0,0,0x30,eth1 console=tty0 console=ttyS0,9600n8"
security: inetd.conf,hosts.deny,hosts.allow,rc scripts
> ssh: (L,W)
dns client: nsswitch.conf or host.conf,resolv.conf
map other filesystems /etc/fstab
install: gzip,unzip,bash,communicator,wget,xpdf
samba: smb.conf,testparm,smbpaswd -a [user]
mount -t cifs //server/share /mnt --verbose -o user=username
additional configuration: conf.modules,/etc/aliases
kernel config:
rpm -Uvh kernel-source-2.0.36-3.i386.rpm kernel-headers-2.0.36-3.i386.rpm
rpm -Uvh kernel-ibcs-2.0.36-3.i386.rpm
cd /usr/src/
para adicionar um driver (neste exemplo DAC960)
tar zxvpf DAC960-2.0.0-Beta4.tar.gz
mv README.DAC960 DAC960.[ch] /usr/src/linux/drivers/block
patch -p0 < DAC960.patch
kernel compilation:
cd /usr/include
rm -rf asm linux scsi
ln -s /usr/src/linux/include/asm-i386 asm
ln -s /usr/src/linux/include/linux linux
ln -s /usr/src/linux/include/scsi scsi
cd /usr/src/linux
make mrproper
make menuconfig
make dep ; make clean
make bzImage
make modules
mv /lib/modules/2.0.36-3 /lib/modules/2.0.36-3-backup
make modules_install
cd /boot
cp vmlinuz vmlinuz.OLD
cp /usr/src/linux/arch/i386/boot/bzImage vmlinuz-2.0.36
/sbin/lilo
--- lilo.conf
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
image=/boot/vmlinuz
label=Linux
root=/dev/hdb1
read-only
image=/boot/vmlinuz.OLD
label=OldLinux
read-only
---
date: date mmddhhmmyy;clock -w (first mm is month)
date --set="Tue May 25 15:33:15"
SERVICES CONFIGURATION:
nfs (solaris):
ORIGEM:
editar /etc/dfs/dfstab e adicionar:
share -F nfs -o ro,nosuid,root=bkpsrvbe1 /opt/apache/htdocs
ao rodar ps -ef|grep nfs, deve aparecer:
/usr/lib/nfs/statd
/usr/lib/nfs/lockd
/usr/lib/nfs/mountd
/usr/lib/nfs/nfsd -a 16
verificar com share
DESTINO:
mount websrv:/opt/apache/htdocs /opt/backup_remoto/websrv
nfs (linux):
server: rpcinfo -p,/etc/hosts,/etc/exports (exportfs),showmount -e
client: mount -t nfs -o soft [server:share] [mounting point]
nis (solaris):
1. alterar /etc/nsswitch.conf e /etc/hosts
2. alterar /etc/passwd colocando +:::::: na ult linha
3. executar domainname
4. editar /etc/defaultdomain
5. (master): criar /etc/ethers /etc/bootparams /etc/locale
/etc/timezone /etc/netgroup /etc/netmasks
6. (client): ypinit -c
(master): ypinit -m
7. /usr/lib/netsvc/yp/ypstart
8. (slave): ypinit -s nis_master_server
9. para parar: /usr/lib/netsvc/yp/ypstop
10. criar grupo telco
11. criar /export/home/telco owner root:telco com permissao 775
12. config /etc/issue, /etc/issue.net, /etc/default/telnetd e .profile
nis(linux):
nis client:
/bin/domainname-yp [nis domain];mkdir /var/yp;/usr/bin/ypbind;rpcinfo -p
/etc/passwd: add: +:*:0:0:::
/etc/group : add: +:*:0:0:
nsswitch.conf
nis server:
generate ypserv,makedbm from .tgz (compile if needed)
copy ypMakefille in /var/yp as Makefile
cd /var/yp;make
yppasswd, ypcat passwd, ypmatch [user] [passwd]
dns: bind,dnsutils,/etc/named.boot (just bind 4),/etc/named.conf
apache: httpd.conf
apache auth:
/usr/local/etc/httpd/users
make httpasswd
httpasswd -c /usr/local/etc/httpd/users [user]
.htaccess
https:
ppp:
database integration: msql+perl or MySQL+php4
firewall:
network: snmp
log analysis: webalizer
perl: Active Perl,perl modules, mrtg
chooser to pick X servers
sendmail Lock
add to /etc/hosts:
127.0.0.1 localhost
hdparm: add the following line to /etc/rc.d/rc.sysinit:
/sbin/hdparm -c1 /dev/hda # first IDE drive assumed
configure zip drive:
chmod 666 /dev/sda4 # everyone can access the Zip Drive
insmod ppa
ln -s /dev/cua0 /dev/mouse
ln -s /dev/cua1 /dev/modem
ln -s /dev/hdb /dev/cdrom
boot messages: /etc/issue, /etc/motd
/etc/sysconfig/mouse
MOUSETYPE="Microsoft"
XEMU3=yes
or gpmconfig
MBR backup:
dd if=/dev/hda of=MBR bs=512 count=1
dd if=/mnt/MBR of=/dev/hda bs=446 count=1
printer
The following files are used for printer operations.
Per job entries are marked with an asterisk (*).
File Name Dir Purpose
printer CD lock file and server process PID
unspooler.printer CD subserver process PID
control.printer CD queue control information
*hfAnnn SD job hold file
*cfAnnnHOST SD job control file
*dfAnnnHOST SD job data file
*bfAnnn.* SD tempory files
The nnn in the file names stands for the job number.
find out which one the parallel print device is: try
echo "hello, world" > /dev/lp0
echo "hello, world" > /dev/lp1
make two spool directories:
cd /var/spool/lpd
mkdir raw ; mkdir postscript
save this script as /var/spool/lpd/raw/filter:
#!/bin/sh
# This filter does away with the "staircase effect"
awk '{print $0, "\r"}'
make a filter for PostScript emulation. Write the following filter
as /var/spool/lpd/postscript/filter:
#!/bin/sh
DEVICE=djet500
RESOLUTION=300x300
PAPERSIZE=a4
SENDEOF=
nenscript -TUS -ZB -p- |
if [ "$DEVICE" = "PostScript" ]; then
cat -
else
gs -q -sDEVICE=$DEVICE \
-r$RESOLUTION \
-sPAPERSIZE=$PAPERSIZE \
-dNOPAUSE \
-dSAFER \
-sOutputFile=- -
fi
if [ "$SENDEOF" != "" ]; then
printf "\004"
fi
finally, add the following entries in /etc/printcap:
# /etc/printcap
lp|ps|PS|PostScript|djps:\
:sd=/var/spool/lpd/postscript:\
:mx#0:\
:lp=/dev/lp1:\
:if=/var/spool/lpd/postscript/filter:\
:sh:
raw:\
:sd=/var/spool/lpd/raw:\
:mx#0:\
:lp=/dev/lp1:\
:if=/var/spool/lpd/raw/filter:\
:sh:
SOFTWARE CONFIGURATION:
date +%y%m%d%H%M (format for log output, for example)
bind in pdksh: Prefix-2,up-history,down-history,forward-char,backward-char
tape:ufsdump,ufsrestore,tar
mt /dev/rmt/0 status
perl modules: download first and then:
perl Makefile.pl;make;make test;make install
or
perl -MCPAN -e shell
cpan> install [module]
emacs: $HOME/.emacs
bash:
/etc/bashrc contains system wide aliases and functions;
/etc/profile contains system wide environment stuff and startup programs;
$HOME/.bashrc contains user aliases and functions;
$HOME/.bash_profile contains user environment stuff and startup programs;
$HOME/.inputrc contains key bindings and other bits.
/etc/aliases
rm -i;cp -i;mv -i;ls -ld
It's a good idea to let new users have a few configuration files ready
when they first log in. Put the following files in /etc/skel:
.bashrc .bash_profile .bash_logout .inputrc .less .xinitrc
.fvwmrc .fvwm2rc95 .Xmodmap .Xdefaults .jedrc .abbrevs.sl. joerc
.emacs
The user can overwrite values set in /etc/profile by creating a file:
~/.bash_profile, ~/.bash_login or ~/.profile.
Note that just the first one of these is executed thus differing
of the logic of csh initialization.
~/.bash_login is not executed specially for login shells
and if .bash_profile exists, it is not executed at all!
debug: put in the 1st line: #!/bin/bash -x
other commands (common options):
tar -zcvf [destiny] [source]
tar -zxvf [destiny] [source]
rsync: verify remote files
nmap -sS [host] (run as root)
wget -r l6 -t1 [URL] (-L is just relative links)
to see system data:
uname -a
dmesg
ulimit -a
df -k
hostname
domainname
cat /etc/sysconfig/network
ifconfig
netstat -nr
netstat -a
cat /etc/inetd.conf
cat /proc/meminfo
cat /proc/filesystem
cat /proc/devices
cat /etc/passwd
to cleanup dos files:
vi : :%s/^V^M//g
shell: sed `s/^V^M//g` foo>foo.new
other commands (common options):
tar -zcvf [destiny] [source]
tar -zxvf [destiny] [source]
rsync: verify remote files
nmap -sS [host] (run as root)
nmap -sT [host] -P0
wget -r l6 -t1 [URL] (-L is just relative links)
Script para isolar o processo:
ps -def | grep Xvnc | grep -v grep | awk -F" " '{print $2}'
onde:
* ele executa o ps normal para todos os processos
* isola as linhas com a palavra Xvnc
* tira dessas linhas as que tiverem a plavra grep para ele nao se achar com o parametro Xvnc enquanto procura
* divide as linhas pelo " " (espaço) e mostra a segunda coluna
to see: crontab -l
to edit: export EDITOR=vi;crontab -e
crontab format:
0 0 * * * calendar
^ ^ ^ ^ ^ ^
| | | | | |
1 2 3 4 5 6
(1) minutes (0 a 59)
(2) hour (0 a 23)
(3) day (1 a 31)
(4) month (1 a 12)
(5) day of the week (0 a 6, where 0 is Sunday)
(6) command (it's good to redirect output to /dev/null)
* means all possible values
- means a range
example:
0,10,20,30,40,50 * * * rmtrash
rmtrash will be executed each 10 minutes
TCP/IP
sendmail (teste):
envio:
/usr/lib/sendmail -v -f $remetente destinatario < dir/filename
recebimento:
$ telnet mail.somewhere.com 25
Trying 192.168.75.194...
Connected to smtp.somewhere.com.
Escape character is '^]'.
220 smtp.somewhere.net ESMTP Sendmail 8.9.3+Sun/8.9.1;
Thu, 12 Oct 2000 04:39:40 -0700 (PDT)
mail from: tony@pcunix.com
250 tony@pcunix.com... Sender ok
rcpt to: foobah@pcunix.com
550 foobah@pcunix.com... Relaying denied
rcpt to: foobah@somewhere.com
250 foobah@somewhere.com... Recipient ok
data
354 Enter mail, end with . on a line by itself
test
look ma no headers!
.
250 HA00945 Message accepted for delivery
quit
221 smtp.somewhere.com closing connection
relay:
telnet mail-abuse.net
MRTG:
MaxBytes = velocidade * 125
AbsMax = 2 * MaxBytes
ThreshMaxI = MaxBytes * 70%
ThreshMaxO = MaxBytes * 70%
Target[ezwf]: 2:public@router1:::::2
The ":::::2" tells MRTG to use SNMPv2
Interface by Description
Target[ezwf]: \My-Interface2:public@wellfleet-fddi.ethz.ch
Target[ezci]: -\My-Interface2:public@ezci-ether.ethz.ch
Target[ezwf]: 1.3.6.1.2.1.2.2.1.14\My-Interface2&1.3.6.1.2.1.2.2.1.14\My-Interface3:public@myrouter
Target[ezwf]: ifInErrors\My-Interface2&ifOutErrors\My-Interface3:public@myrouter
If your description contains a ``&'', a ``:'', a ``@'' or a `` '' you can include
them but you must escape with a backlash:
Target[ezwf]: \fun\:\ ney\&ddd:public@hello.router
Interface by Name
Target[ezwf]: #2/11:public@wellfleet-fddi.ethz.ch
Target[ezci]: -#2/11:public@ezci-ether.ethz.ch
Target[ezwf]: 1.3.6.1.2.1.2.2.1.14#3/7&1.3.6.1.2.1.2.2.1.14#3/7:public@myrouter
Target[ezwf]: ifInErrors#3/7&ifOutErrors#3/7:public@myrouter
If your description contains a ``&'', a ``:'', a ``@'' or a `` '' you can include
them but you must escape with a backlash:
Target[ezwf]: #\:\ fun:public@hello.router
HP OPENVIEW:
/etc/opt/OV/share/conf/netmon.noDiscover
1-199.*.*.*
200.0-141.*.*
200.142.0-63.*.*
200.142.96-255.*.*
200.143-151.*.*
200.152.0-191.*.*
200.152.225-255.*
200.153-159.*.*
200.160.0-223.*.*
200.161-224.*.*
200.225.0-63.*.*
200.225.80-255.*.*
200.226-255.*.*
filtros hpov:
reorganizacao da topologia:
/opt/OV/bin/ovstop netmon
/opt/OV/bin/ovtopofix -ua
/opt/OV/bin/ovstart netmon
arquivo: $OV_CONF/$LANG/C/filters
sintaxe:
MRoutingBlocks "Blocos de Mrouting"
{
(("IP Address" ~ 10.0.17.*) ||
("IP Address" ~ 10.24.0-3.*) ||
("IP Address" ~ 10.25.1.64-126) ||
("IP Address" ~ 172.16-31.*.*) ||
("IP Address" ~ 192.168.*.*) ||
("IP Address" ~ 10.80.32.254)||
("IP Address" ~ 10.19.36.254)||
("IP Address" ~ 10.16.36.253) || isNode || isSegment)
}
Certificado de Seguranca:
1. openssl req -new > metrored.csr
2. será gerado metrored.csr e privkey.pem (guardar)
3. enviar para certisign
4. openssl rsa -in privkey.pem -out new.cert.key
5. renomear arquivos enviados pela Certisign
com os nomes CA.cert e METRORED.CERT
6. copiar todos os arquivos em /opt/apache/conf
7. reiniciar apache
MySQL:
grant all on [database].* to [user]@[hostname]
set password for [user]@[hostname]=password('string')
show grants for [user]@[hostname]
create table [table] (
[field] [integer,char(00)...] primary key,
[field] [integer,char(00)...] [null/not null],
[field] [integer,char(00)...] [null/not null],
...
)
alter table [table] add [field] [integer,char(00)...] [null/not_null]
select [fields] from [table]
where [condition]
order by [field] [asc|desc]
limit x,y
insert into [table] (a,b,c) values (1,2,3)
update [table] set name1=value1,name2=value2 where [condition]
delete from [table] where [condition]
ORACLE
select count(rowid) from [table] where [condition]
select [fields] from [table] where [condition] and rownum <= [quantity]
Para ver processos oracle no unix:
select process,sid,serial# from v$session where osuser = [user]