|
Commande
|
Que faire
|
Httpd
|
kill -TERM `cat /usr/local/apache/logs/httpd.pid`
|
/etc/rc.d/init.d/httpd restart
|
(Voir aussi Apache Documentation)
Perl
Perl –MCPAN –e shell
install Bundle ::CPAN
reload cpan
Samba
Immédiatement après une installation fraîche de Linux, je désire avoir un directory WIN2K partagé par les deux machines Linux (ZEBRA et JAGUAR):
# mkdir /winpub - c'est tout dont il a besoin step 0
C’est dans ce directory qu’on va coller un disque WIN2K
export USER=oracle
export PASSWD=xxxx
smbmount //fatboy/w$ /winpub uid=oracle rw
Ou xxxx est le password de connexion de l’utilisateur oracle WIN2K.
Modification dans /etc/samba/smb.conf, et redemarrer: /sbin/service smb.
[global]
netbios name = zebra
smb, nmb
VNC
Download (je prends su RPM), installer.
Pour avoir un vrai bureau X, modifier les paramètres dans .VNC dans les divers homes.
NTP
redhat-config-date
Machine
Find /etc –exec grep –l “zebra” {} \;
Le nom de la machine figure (pour moi) dans:
/etc/sysconfig/network, /etc/samba/smb.conf,
Shell
Modifier le texte OFS2 en OFS3 dans les fichiers (*.trc) présents dans le répertoire.
$ find . -depth -iname *.trc -print | while read name ; do
cp -v $name $name.bak; sed s'/OFS2/OFS3/g' $name.bak > $name;
done
aliases
(in /etc/profile or $HOME/.bash_profile)
alias rm="rm -iv" alias cp="cp -iv" alias mv="mv -iv" alias chown="chown -v" alias chgrp="chgrp -v"
shortcuts
alias hid="ls -a1 | grep \"^\\.\""alias startx="startx -- -bpp 16"alias vcd="xreadvcd | mtv - &"
Fichiers
find -name "*" -exec rm {} \;
This command finds all the files and removes them. The slash is to escape the semicolon. We don't want the semicolon to be taken as a command separator. (it's a command delimiter for the exec parameter).
find -name "*" -exec rm {} \;; ls
This command finds and removes all files and executes ls.
find -type f -print
Find only regular files (not directories, sockets, etc).
find . -type f -exec grep foo {} \;
Find patterns 'foo' in all files starting from the current directory(.).
find dirname
List full pathnames of files in directory dirname.
Partitionnement
Pour partitionner un disque en fonction d’un partitionnement existent (cloner) :
1) Sauvegarder la configuration :
[root@zebra root]# sfdisk -d /dev/hdb > /tmp/partition.diskb
[root@zebra root]# cat /tmp/partition.diskb
# partition table of /dev/hdb
unit: sectors
/dev/hdb1 : start= 63, size= 208782, Id=83, bootable
/dev/hdb2 : start= 208845, size= 20482875, Id=83
/dev/hdb3 : start= 20691720, size= 4080510, Id=82
/dev/hdb4 : start= 0, size= 0, Id= 0
[root@zebra root]#
2) La reprendre sur une autre machine:
Utiliser l’excellent script (clone.sh) (http://lists.progeny.com/archive/progeny-debian/200105/msg00124.html)
Etapes post-installation RH8
Pendant l’install
Oui, j’en fais une, vu que j’ai trois disques et que je ne sais pas ce que peut arriver.
Pour un EIZO FlexScan L565 : Eizo Analog: H: 24.8 – 80 kHz, V: 50 – 75 Hz kHz
Color Depth : High Color (16 Bit), 1280x1024 (Test Setting)
Faites-le, au moins pour une configuration ;-)
Jettez un coup d’œil au /etc/fstab
Automatisation du lancement au lancement
/sysop/postinstalllinux.sh
#!/bin/sh -f
# 755
#
# Rendre un rep Windows visible immediatement apres
# l'install linux
# A faire sous root
# Radu Caulea, TAFORA
#
mkdir /sysop
mkdir /admin # rep de montage
adduser administrateur # utilisateur windows
passwd administrateur
smbpasswd -a administrateur
adduser oracle
passwd oracle
smbpasswd -a oracle
export USER=oracle
export PASSWD=oracle
smbmount //fatboy/linux /admin uid=oracle rw
/etc/rc.d/init.d/smb start # pour que le poste NT voie /home/administrateur
/sysop/scr/bootsysop
#!/bin/sh
# Startup automatique du (des) script(s) initial(ux)
# -------------------------------------------------
# Copyright 2002 TAFORA
# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
exit 0
fi
export ORACLE_BASE=/taf/oracle
export ORACLE_HOME=/taf/oracle/920
export ORACLE_OWNER=oracle
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG=french_france.WE8ISO8859P15
export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib export LD_LIBRARY_PATH
case "$1" in
"start") # start div
echo "Demarrage des divers choses"
/sysop/scr/sysopboot.sh
;;
"stop") # Stop div
echo "Arret des divers choses"
/sysop/scr/sysopreboot.sh
;;
esac
/sysop/scr/sysopboot.sh
#!/bin/sh -f
#
# start everything
#
cd /sysop/scr
#./serveurvnc.sh
./sambastart.sh
./sambawin.sh
/sysop/scr/sysopreboot.sh
#!/bin/sh -f
#
# start everything
#
cd /sysop/scr
./sambastop.sh
./sambawinstop.sh
/sysop/scr/sambastrart.sh
#!/bin/sh -f
echo "== ------------------------ =="
echo " Demarrer les services samba"
/etc/rc.d/init.d/smb start
/sysop/scr/sambastop.sh
#!/bin/sh -f
echo "== ------------------------ =="
echo " Demarrer les services samba"
/etc/rc.d/init.d/smb stop
/sysop/scr/sambawin.sh
#!/bin/sh -f
# 755
#
echo "== ------------------------ =="
echo " Demarrer le contact winpub "
export USER=oracle
export PASSWD=oracle
smbmount //fatboy/linux /admin uid=oracle rw
/sysop/scr/sambawinstop.sh
#!/bin/sh -f
# 755
#
echo "== ------------------------ =="
echo " Briser le contact winpub "
smbumount /admin
Automatisation du lancement au lancement
C’est l’automatisation effective. Lancer mksysoplinks.sh apres avoir copié bootsysop.sh dans /etc/rc.d/init.d
#!/bin/sh
# -------------------------------------------------
# Copyright 2002 TAFORA
cd /etc/rc.d/rc0.d
rm K10bootsysop
ln -s ../init.d/bootsysop K10bootsysop
cd /etc/rc.d/rc1.d
rm K10bootsysop
ln -s ../init.d/bootsysop K10bootsysop
cd /etc/rc.d/rc2.d
rm K10bootsysop
rm S99bootsysop
ln -s ../init.d/bootsysop K10bootsysop
ln -s ../init.d/bootsysop S99bootsysop
cd /etc/rc.d/rc3.d
rm K10bootsysop
rm S99bootsysop
ln -s ../init.d/bootsysop K10bootsysop
ln -s ../init.d/bootsysop S99bootsysop
cd /etc/rc.d/rc4.d
rm K10bootsysop
rm S99bootsysop
ln -s ../init.d/bootsysop K10bootsysop
ln -s ../init.d/bootsysop S99bootsysop
cd /etc/rc.d/rc5.d
rm K10bootsysop
rm S99bootsysop
ln -s ../init.d/bootsysop K10bootsysop
ln -s ../init.d/bootsysop S99bootsysop
cd /etc/rc.d/rc6.d
rm K10bootsysop
ln -s ../init.d/bootsysop K10bootsysop
Diskette de boot
$ uname –r
et
mkbootdisk 2.4.18-4
Telnet
Pour l’avoir, l’allumer ;-) (services, etc)
Afficher ailleurs
Si vous avez quelque part un display X, envoyez le toutim ailleurs ;-)
xterm -display 192.168.0.3:0.0 &
cat /usr/share/config/kdm/kdmrc
[Xdmcp]
# Whether KDM should listen to XDMCP requests. Default is true.
Enable=true
cat /etc/X11/gdm/gdm.conf
[xdmcp]
# Distributions: Ship with this off. It is never a safe thing to leave
# out on the net. Alternatively you can set up /etc/hosts.allow and
# /etc/hosts.deny to only allow say local access.
Enable=true
Up2date
Le certificat SSL de RedHat a expiré en fin août. Prendre chez eux
(https://rhn.redhat.com/help/latest-up2date.pxt)
up2date-3.0.7.2-1.i386.rpm
up2date-gnome-3.0.7.2-1.i386.pxt
Et ensuite:
rpm -Uvh up2date-*.rpm
Postfix
Verifier que votre MTA est bien configuré :
http://www.kobitosan.net/postfix/antispam-en.html
% telnet relay-test.mail-abuse.org
Backup
Machine hda, hdb, hdc, Grub, le BIOS boote sur had
Les partitions sont :
Distrib securisée : hdc hdc1 boot, hdc2 /
Distrib autre hdb1 boot, hdb3 /
Pour backuper la distrib sécurisée, boot autre et
mount /dev/hdc2 /mnt/hdc2
tar cjPf slash.tar.bz2 /mnt/hdc2
mount /dev/hdc1 /mnt/hdc1
tar cjPf boot.tar.bz2 /mnt/hdc2
Pour restaurer la distrib sécurisée, boot autre et
mount /dev/hdc2 /mnt/hdc2
cd /mnt/hdc2
rm -rf *
cd /
tar xjf /root/slash.tar.bz2
mount /dev/hdc1 /mnt/hdc1
cd /mnt/hdc1
rm -rf *
cd /
tar xjf /root/boot.tar.bz2
Les services
Service –status-all
USB
File system
mkfs -tvfat /dev/sda1
/etc/fstab
/dev/sda1 /mnt/usbhd vfat noauto,user,owner,rw 0 0
Redirection
>, Redirect stdout to file, ls > myfiles, Send stdout from the ls command to the file "myfiles"
<, Redirect stdin to file, cat < myfiles, Use the contents of the file "myfiles" as stdin
>>, Append stdout to file, echo "My file list" >> myfiles, Append the line "My file list", which is stdout from the echo command, to the file "myfiles"
|, Pipe stdout from one command to stdin for the next command, ls | grep my , Use stdout from the ls command as stdin for the grep command
2>/dev/null, Redirect stderr to /dev/null, grep My ./* 2>/dev/null, Send stderr from the grep command to /dev/null
2>&1, Redirect stderr to stdout, grep My ./* >outfile 2>&1, Send stderr from the grep command to stdout, send stdout to the file "outfile"
0 stdin, 1 stdout, 2 stderr
Job control
Ctrl+z Stop job Freeze job. Don't kill it. Job kan be put in forground or background afterwards.
Ctrl+c Break Break/kill running command
Ctrl+d Logout/exit Exit current shell, or finish typing interactive command
jobs jobs jobs Displays job number and current state of jobs
bg bg %jobnumber bg %1 Put job with the given number in the background
fg fg %jobnumber fg %3 Put job with the given number in the foreground
& command & emacs & Start the job (here emacs) in the background
Fichiers modifiés pendant les dernières 120 minutes
find / -mmin 120
find . -type f -size +10000 -exec grep hello {} /dev/null \;
Stats