31 Mayıs 2012 Perşembe

Unix komutları -7


Log Files

Solaris
Red Hat
Ubuntu/Debian
HP
AIX
messages
/var/adm/messages
/var/log/messages
/var/log/messages
/var/adm/syslog/syslog.log
/var/adm/ras
syslog
/var/log/syslog
/var/log/syslog
/var/log/syslog
/var/adm/syslog/syslog.log
/var/adm/ras
mail

/var/log/mail
/var/log/mail.*
/var/adm/syslog/mail.log
/usr/spool/mqueue/syslog
cron
/var/cron/log
/var/log/cron
/var/log/cron.log
/var/adm/cron/log
/var/adm/cron/log
boot
/var/adm/messages
dmesg
/var/log/boot
dmesg
/var/log/boot
dmesg
/var/adm/syslog/syslog.log
dmesg
/var/adm/ras

alog -o -t boot
alog -o -t console
alog -L  (list all the logs available)
Error logging
logger
logger
logger
logger
/usr/lib/errdemon -l (display attributes) 
/usr/lib/errdemon (start error logging)
 
/usr/lib/errstop (stop error logging)
# use with above errorlog file 
errpt (summary errorlog report)
errpt -a (detailed errorlog report)
errpt -j <identifier> (single errorlog report)

errclear (clears errorlog)
errclear -d <class><days> (clears class errors)

errlogger "message upto 230 chars"
 
Security

Solaris
Red Hat
Ubuntu/Debian
HP
AIX
Checking the passwd file
pwck
pwck
pwck
pwck
pwdck -t ALL 
usrck -t ALL
checking the group file
grpck
grpck
grpck
grpck
grpck
console login (allow/deny)
# No reboot required 
/etc/default/login
# No reboot required 
/etc/securetty
# No reboot required 
/etc/securetty
# No reboot required 
/etc/securetty

Note: you may need to create this file if it does not exist
# No reboot required
/etc/security/user

chsec -f /etc/security/user -s root
Misc

Solaris
Red Hat
Ubuntu/Debian
HP
AIX
startup
eeprom
setenv boot-device
grub (GUI)
lilo (text based)
grub (GUI)
setboot -p <primary path>
setboot -a <alternate path>

# autoboot sequnce
 
setboot -b [on|off]
bootlist -m normal hdisk0 hdisk1
shutdown
shutdown -i5 -g0 -y (power down)
shutdown -i6 -g0 -y (reboot)
shutdown -i0 -g0 -y (OK prompt)
reboot -- -r (reboot/reconfigure)

touch /reconfigure
shutdown -h (halt)
shutdown -r (reboot)
shutdown -f (fast reboot no fsck)
shutdown -F (force fsck)
shutdown -h (halt)
shutdown -r (reboot)
shutdown -P (power off)
touch /forcefsck
# edit /etc/default/rcS change below so 
# you dont have to hang around
 
FSCKFIX=yes
shutdown -h now (halt)
shutdown -r now(reboot)
shutdown -F (fast shutdown) 
shutdown -Fr (fast shutdown and reboot)
Change run level
halt
init
poweroff
reboot
shutdown
telinit
uadmin
halt
init
poweroff
reboot
shutdown
telinit
halt
init
poweroff
reboot
shutdown
telinit
init
reboot
shutdown
init
shutdown
reboot
 
telinit
halt
init status
0
1
2
3
4
5
6

0 - shutdown
1 - single user
2 - n/a
3 - Multi-user
4 - n/a
5 - power off
6 - reboot

# change default
vi /etc/inittab

0 - halt
1 - single user
2 - multiuser (no networking)
3 - multiuser (networking)
4 - unused
5 - GUI
6 - reboot

# change default
vi /etc/inittab

0 - halt
1 - single user
2 - multiuser (default)
3 - same as 2
 
4 - same as 2
 
5 - same as 2
 
6 - reboot
 



# change default - change all the telinit
 
vi /etc/event.d/rc-default

0 - halt
1 - single users
2 - multiuser (networking)
3 - multiuser (networking, NFS, and CDE GUI) (default)
 
4 - multiuser (netwrking, NFS, and VUE GUI)
5 - n/a
6 - n/a

# change default - change the initdefault line 
vi /etc/inittab

0 - reserved
 
1 - reserved
 
2 - multiuser mode with NFS
 
3 - user defined
 
4 - user defined
 
5 - user defined
 
6 - user defined
 
7-9 - user defined
# change default - change the initdefault line 
vi /etc/inittab
Startup options
-s single user
-a interactive
-x no device drivers (used in clustering)
 
-r reconfigure devices
-m milestone
single  - use grub to edit kernel line 
emergency - use grub to edit kernel line
 
linux rescue - use at the boot prompt
single: runlevel1, local fs mounted, no network
emergency: root fs read-only, no init files run
 
rescue: use cd-rom/network, root mounted as /mnt/sysimage
single  - use grub to edit kernel line 
emergency - use grub to edit kernel line
 
linux rescue - use at the boot prompt
single: runlevel1, local fs mounted, no network
emergency: root fs read-only, no init files run
 
rescue: use cd-rom/network, root mounted as /mnt/sysimage
interact with IPL? Y

# single user
 
ISL> hpux -is
# Logical volume maintanence mode 
ISL> hpux -lm

# No quroum check
ISL> hpux -lq
Based on 9114-275 workstation
1. switch off the machine

2. power on and enter the SMS menu

Note: to enter the SMS menu press numeric 1 after the word keyboard but before the word speaker
 


startup scripts
/etc/init.d

/etc/rc0.d - /etc/rc6.d
/etc/init.d

/etc/rc0.d - /etc/rc6.d
/etc/init.d

/etc/rc0.d - /etc/rc6.d
/sbin/init.d
/etc/rc.config.d (startup config files)
 

/sbin/rc0.d - /sbin/rc6.d
/etc/rc.d
/etc/rc.d/init.d

/etc/rc.d/rc2.d - rc9.d

/etc/rc.* (config files for auto-starting)
also uses the System Resource Controller
boot prompt commands
boot
printenv
setenv
banner
devalias
show-devs
show-pci-devs-all
 
probe-scsi-all
probe-fcal-all
probe-pci
 
watch-net-all
reset-all
F10 or F12
F10 or F12
interact with IPL? Y
Based on a 9114-275 workstation
1. switch off the machine

2. power on and enter the SMS menu

Note: to enter the SMS menu press numeric 1 after the word keyboard but before the word speaker
Boot process
Phases:
  • Boot PROM: displays system information, run POST, load bootblk, locate ufsboot
  • Boot Programs: bootblk loads and executes the ufsboot
  • Kernel Initialization: ufsboot loads and executes the core kernel, initializes core kernel data structures, loads other kernel modules based on the/etc/system file, starts/sbin/init program
  • init: starts other processes based on the /etc/inittab file
Boot sequence
1.     BIOS
2.     POST
3.     Master Boot Record (MBR) - point to the bootloader GRUB or LILO
4.     GRUB (stage 1) - point to GRUB stage 1_5
5.     GRUB (stage 1_5) - deals with specific filesystem types look at /boot/grub/*1_5 files
6.     GRUB (stage 2) – reads /etc/grub.conf and displays the grub menu, it specifies the kernel and the initrd files
7.     KERNEL - control given to the kernel
8.     INIT - reads /etc/inittab and runs /etc/rc.d/rc.sysinit script
Boot sequence
1.     BIOS
2.     POST
3.     Master Boot Record (MBR) - point to the bootloader GRUB or LILO
4.     GRUB (stage 1) - point to GRUB stage 1_5
5.     GRUB (stage 1_5) - deals with specific filesystem types look at /boot/grub/*1_5 files
6.     GRUB (stage 2) – reads /boot/grub/menu.lst and displays the grub menu, it specifies the kernel and the initrd files
7.     KERNEL - control given to the kernel
8.     INIT - runs the /etc/event.d/rc-default script
Phases:
1.     PDC - processor-dependent code; executes and performs self-tests
2.     ISL - initial system loader; loads the secondary system loader hpux
3.     HPUX - is the secondary system loader and loads the kernel /stand/vmunix, then hands over to the kernel
4.     KERNEL - swapper processes are started by the kernel then starts the init process
5.     INIT - reads /etc/inittab
Phases:
  • Read Only Storage (ROS): check the system board, perform POST, locate and load boot image, begin system initialization and execute phase 1 of the /etc/rc.boot script
  • Base Device Configuration: start configuration manager to configue base devices
  • System Boot: start init process phase 2, switch to hard-disk root filesystem, start other processes defined by /etc/inittab and execute phase 3 of the /etc/rc.boot script
determine the run level
who -r
runlevel
who -r
runlevel
who -r
who -r
who -r
obtain default run level
cat /etc/inittab
cat /etc/inittab
/etc/event.d/rc-default
/etc/inittab
/etc/inittab
list locale
locale -a
locale -a
locale -a
locale -a
locale -a
start xwindows
n/a
startx (shorthand of below)
initx (lots of parms)

n/a
n/a
initialize system
sys-unconfig


set_parms [initial|hostname|ip_address|timezone]

Note: set_parms is in /sbin
install_assist
Timezone
/etc/TIMEZONE
/etc/default/init
/etc/sysconfig/clock
/usr/share/zoneinfo/zone.tab
/etc/timezone
/usr/share/zoneinfo/zone.tab
/etc/TIMEZONE
/etc/environment
/etc/profile


0 yorum:

Yorum Gönder