SystemAdministration

First thing you do when you log in to a system is check disk and cpu load

df -k
Show filesystem usage in Kilobytes
top
List most active processes on one screen every 3 seconds.
prstat
Same as top for Solaris systems
uptime
Reports the system uptime and load average.
vmstat 5 5
Report several performance indicators 5 times with a 5 second interval.
The first line of output must be ignored as it mainly reports on the startup of vmstat itself. The output differs from one *nix to another. On solaris check the Scan Rate (sr), this is the rate the system searches for free memory pages. Values above 150 indicate a shortage on memory. Also high figures for swapin/out indicate memory problems

Load average, as reported by top and uptime represents the load average during the last 1 minute, 5 minutes, and 15 minutes respectively. The values gives the average of the number of processes running on a CPU plus the number of processes waiting in the run-queue. According to some people the load of the system is optimal if it equals the number of processors.

iostat 5 5
Report IO and CPU statistics 5 times with a 5 second interval

System events are often logged in a file. A nice place to put logfiles is /var/log. Most linux system put everything there. Other unix implementations (HP-UX) may also use /var/adm.

> file
cp /dev/null file
cat /dev/null > file
Empty file without changing the inode, usefull for emptying open log-files

/dev/null is not an ordinary empty file. It can be used as ‘black hole’ e.g. if processes write output you don’t want to see you can redirect it to /dev/null. If accidentally remove it will be created as an ordinary file the first time it is written. When another process now uses /dev/null to empty something you may be surprised by the mess.

mknod /dev/null c 1 3
chmod 666 /dev/null
Recreate /dev/null in Debian/Ubuntu
mknod /dev/null c 3 0x02
chown bin:bin /dev/null
chmod 666 /dev/null
Recreate /dev/null in HP-UX
mknod /dev/null c 13 2
chown bin:bin /dev/null
chmod 666 /dev/null
Recreate /dev/null in Solaris
mknod /devices/pseudo/mm@0:null c 13 2
chown root:sys /devices/pseudo/mm@0:null
chmod 666 /devices/pseudo/mm@0:null
ln -s /devices/pseudo/mm@0:null /dev/null mknod /dev/null c 13 2
chown bin:bin /dev/null
chmod 666 /dev/null
Recreate /dev/null in Solaris (not tested by me)
tput sgr 0 0 
Restore terminal configuration. If you jeopardized your terminal, e.g. by a cat of an executable this command may put it right.

Software management Debian

apt-get update
Update list of packages
apt-get dist-upgrade
Upgrade all installed packages
apt-cache search <item>
List all available packages containing <item>
/etc/apt/sources.list
List of servers delivering the packages, this determines which version you run. A source lines looks like:
deb http://security.debian.org/ stable/updates main
dpkg –list
List all installed packages
aptitude
A high level interface to several package management commands
aptitude show <package>
show detail about <package>
aptitude install <package>=<version>
Force installation of <version> for <package> dependent packages will be downgraded if needed too.
For the correct syntax of a previous version you can check /var/log/dpkg.log.

Software management Solaris

All files are in /var/sadm, this directory will grow as you do have the opportunity to roll back to any version of the software.

If you are sure you do not need to roll-back you can delete the undo.Z files under /var/sadm/pkg

showrev
Show installed software

-p
Show installed patches
-w
Show Open Windows version
 pkgchk -l -p /usr/lib/sendmail
Show packet information of the packet /ust/lib/sendmail is part of.

SUN solaris specifics for daemons

Daemons in Solaris put a timestamp in the kernel that is just ahead of the system time. The fastfail function checks the daemon times with the system time. If the system-time is ahead of the daemon-time the daemon is not working and a panic is generated. This is often used in cluster environment.

Solaris 10 introduces the SMF (Service managemend Facility) to start/stop daemons on the system.
Scripts are stored in /lib/svc/method

svcs
List services
svcs -l <service name>
Details on a service
svcs restart <service name>
To restart
svcadm clear <service name>
Clear maintenance mode

Sun systems switch

Sun systems often have a small key on the front that can be switched to four positions

Normal
This key position allows the system Power button
to power the system on or off. If the operating system is running,
pressing and releasing the Power button initiates a graceful software
system shutdown. Pressing and holding the Power button in for five
seconds causes an immediate hardware power off. which could cause disk
corruption and loss of data—this should be used only as last resort.
Locked
This key position disables the system Power
button to prevent unauthorized users from powering the system on or
off. It also disables the keyboard L1-A (Stop-A) command, terminal
Break key command, and ~# tip window command, preventing users from
suspending system operation to access the system ok
prompt. The Locked setting, used for normal day-to-day operations, also
prevents unauthorized programming of the system boot PROM.
Diagnostics
This key position forces the power-on self-test
(POST) and OpenBoot Diagnostics software to run during system startup
and system resets. The Power button functions the same as when the
system control switch is in the Normal position.
Forced Off
The Forced Off setting also prevents a Remote
System Control (RSC) session from restarting the system. However, the
RSC card continues to operate using the system’s 5-volt standby power.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.