You are on page 1of 3

Solaris 10 System Administration $ du –ah ; $ du -ak Scheduling and Managing System Tasks

Displaying the Size of Directories, Subdirectories, and Files $ crontab -e [username]


Advanced Administration # quot –a Create or Edit a crontab File
By Johnell Averilla Lists all users of each mounted UFS file system and the number of $ crontab -l [username]
1024-byte blocks used. Display crontab file
$ ls -t [directory] $ ls -l /var/spool/cron/crontabs
Displaying and Changing System Information List files, displaying the most recently created or changed files first VerifyThat a crontab File Exists
# isainfo –v $ crontab -r [username]
Determining Whether a System Has 32–Bit or 64–Bit Solaris Finding and Removing Old or Inactive Files Remove crontab file
Capabilities Enabled # find /var/adm -type f -atime +60 -print > /var/tmp/deadfiles & /etc/cron.d/cron.deny
$ cat /etc/release Delete files in /var/adm that are not accessed within 60 days users who are listed in this file can not create, edit, display, or
How to Display Solaris Release Information # rm ‘cat /var/tmp/deadfiles‘ remove crontab files.
$ showrev –a /etc/cron.d/cron.allow
Displaying General System Information # rm -r * users who are listed in this file can create, edit, display, or
$ hostid Delete the files and subdirectories in the current directory remove crontab files.
Displaying a System's Host ID Number # find . -name core -exec rm {} \; EXAMPLE CRON FILE
# prtconf –vb Find and remove any core files in this directory and its subdirectories. # use /bin/sh to run commands, overriding the default set by cron
Displaying a System's Product Name SHELL=/bin/sh
# prtconf | grep Memory How to Delete Crash Dump Files # mail any output to `johnell', no matter whose crontab this is
Displaying a System's Installed Memory Crash dump files can be very large. If you have enabled your system to MAILTO=johnell
$ date store these files, do not retain them for longer than necessary. #
Displaying the Date andTime # cd /var/crash/system # run five minutes after midnight, every day
$ psrinfo –v # rm * 50*** $HOME/bin/daily.job >> $HOME/tmp/out 2>&1
Displaying a System's Processor Type # run at 2:15pm on the first of every month -- output mailed to johnell
# localeadm –l 15 14 1 * * $HOME/bin/monthly
Display the locales currently installed on your system Managing Quotas # run at 9 pm on weekdays, annoy John
# date 0121173404 (mmddHHMM[[cc]yy]) Howto Configure File Systems for Quotas 0 21 * * 1-5 mail -s "It's 10pm" john%John,%%Where are you?%
Thu Jan 21 17:34:34 MST 2004 Edit the /etc/vfstab file and add rq to the mount options field for each 23 0-23/2 * * * echo "run 23 minutes after midn, 2am, 4am ..., everyday"
Set a System'sDate andTime Manually UFS file system that will have quotas. 5 4 * * sun echo "run at 5 minutes after 4 every sunday"
# vi /etc/motd Change directory to the root of the file systemthat will have quotas.
Edit message of the day Create a file named quotas. Command at Example
# sys-unconfig # touch quotas $ at 11:45pm July 31
Reconfigure the system Change permissions to read/write for superuser access only. at> rm /home/smith/*core*
# chmod 600 quotas at> Press Control-d
Change a System's Host Name commands will be executed using /bin/csh
Change the system's host name in the following files: Sample /etc/vfstab: Quota enabled in /export/home job 933486300.a at Tue Jul 31 23:45:00 2004
■ /etc/nodename # device device mount FS fsck mount mount /etc/cron.d/at.deny
■ /etc/hostname.*interface # to mount to fsck point type pass at boot options users who are listed in this file cannot access at commands
■ /etc/inet/hosts # pluto:/export/home - /export/home nfs - yes rq $ atq
■ /etc/inet/ipnodes – Applies only to some releases of Solaris 10. Displays at queue
Rename the host name directory within the /var/crash directory. # edquota username $ at -r jobnamehere.a
# cd /var/crash Set Up Quotas for a User Remove an at queue
# mv old-host-name new-host-name # quota -v username
Reboot the systemto activate the new host name. Verify the user's quota
# init 6 # quotacheck –va Managing System Processes
Check Quota Consistency $ ps –ef
Managing Disk Use # quotaon [-v] -a filesystem ... List all running processes. Alternatives below
$ df –h ; $ df –k ; $ df –ak ; $ df –ah Turn on file system quotas, -a turn on all quotas in vfstab # prstat
Displaying Information About File Size and Disk Space # quota [-v] username # top
$ ls –lh Check for Exceeded Quotas # pgrep processname
Displaying the Size of Files # repquota [-v] -a filesystem Obtains the process ID for the process
$ ls -l | sort +4rn | more Check Quotas on a File System, -a reports on all filesystems # pwdx processidnumber
Finding Large Files (Sorting by the Fifth Field's Character) # quotaoff [-v] -a filesystem ... Displays the current working directory for the process
$ ls -s | sort -nr | more Turn off quota # ptree processidnumber
Finding Large Files (Sorting by the Left Most Character) Displays the process tree that contains the process
$ find . -size +400 –print # pfiles processidnumber
find files larger than 400 blocks in the current working directory Displays fstat and fcntl information
# pstop processidnumber $ sar –p Managing System Crash Information
Stops the process Check Page-In Activity # dumpadm
# prun processidnumber $ sar –q Display the current crash dump configuration
Restarts the process Check Queue Activity # dumpadm -c content -d dump-device -m nnnk | nnnm | nnn% -n -s
$ pkill [signal] processaname $ sar –r savecore-dir
$ kill [signal-number] processidnumber Check Unused Memory Modify Crash DumpConfiguration
Terminate the process $ sar –u Example:
Displaying Basic Information About Process Classes Check CPU Utilization # dumpadm
# priocntl –l $ sar –v Dump content: kernel pages
CONFIGURED CLASSES Check System Table Status Dump device: /dev/dsk/c0t3d0s1 (swap)
================== $ sar –w Savecore directory: /var/crash/pluto
SYS (System Class) Check Swapping Activity Savecore enabled: yes
TS (Time Sharing) $ sar –y # dumpadm -c all -d /dev/dsk/c0t1d0s1 -m 10%
Configured TS User Priority Range: -60 through 60 Check Terminal Activity Dump content: all pages
FX (Fixed priority) # sar –A Dump device: /dev/dsk/c0t1d0s1 (dedicated)
Configured FX User Priority Range: 0 through 60 Check Overall System Performance Savecore directory: /var/crash/pluto (minfree = 77071KB)
IA (Interactive) Set Up Automatic Data Collection Savecore enabled: yes
Configured IA User Priority Range: -60 through 60 Run the svcadm enable system/sar:default command. # /usr/bin/mdb -k unix.0
$ ps –ecl | grep processname Command writes a special record that marks the time when the Examining a Crash Dump
Display the global priority of a process. Higher PRI has higher priority counters are reset to zero (boot time). # dumpadm -n | -y
# priocntl -e -c TS -m 60 -p 60 find . -name core –print # crontab -e sys Disable or enable the saving of crash dumps on your system
Shows how to start the find command with the highest possible Uncomment the following lines:
user-supplied priority 0 * * * 0-6 /usr/lib/sa/sa1 Troubleshooting Miscellaneous Software Problems
# priocntl -e -c RT -m 500 -p 20 myprog 20,40 8-17 * * 1-5 /usr/lib/sa/sa1 What to Do if Rebooting Fails
Shows how to execute a command with a 500-millisecond time slice, a 5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A - The system can't find /platform/‘uname -m‘/kernel/unix.
priority of 20 in the RT class, and a global priority of 120 $ sar -u 10 2 You may need to change the boot-device setting in
Takes two data samples separated by 10 seconds the PROMon a SPARC based system
Monitoring System Performance /var/adm/sa/sadd What to Do if You Forgot Root Password
$ vmstat 5 Files stored here (Use keyboard abort sequence--Press Stop A keys to stop the system)
DisplayingVirtual Memory Statistics at 5-second intervals $ sar ok boot cdrom –s (or) ok boot net -s
$ vmstat –s Command extracts data from a previously recorded file # mount /dev/dsk/c0t3d0s0 /a
Display SystemEvent Information # cd /a/etc
$ vmstat –S Troubleshooting Software Problems # TERM=vt100
Display Swapping Statistics # export TERM
$ vmstat –i Managing System Messages # vi shadow
Display Interrupts Per Device $ dmesg ; $ more /var/adm/messages (Remove root’s encrypted password string)
Viewing System Messages # cd /
$ iostat 5 # logadm -w /var/apache/logs/access_log -s 100m # umount /a
HowtoDisplayDisk Utilization Information every 5 seconds Apache access_log file is rotated when it reaches 100MB in size # init 6
$ iostat –xtc /etc/logadm.conf What to Do if a System Hangs
display extended disk statistics File includes log rotation entries for processes A system can freeze or hang rather than crash completely if some
$ df –k /etc/syslog.conf software process is stuck.
Display Disk Space Information Edit file, adding or changing message sources, priorities, and message 1. Determine whether the system is running a window environment and
locations according to the syntax described in syslog.conf(4). follow these suggestions.
$ sar –a ■ Make sure the pointer is in the window where you are typing the
Display file access operation statistics Managing Core Files - Core files are generated when a process or commands.
$ sar –b application terminates abnormally. Core files are managed with the ■ Press Control-q in case the user accidentally pressed Control-s,
Display buffer activity statistics coreadm command. which freezes the screen. Control-s freezes only the window, not the
$ sar –c $ coreadm entire screen. If a window is frozen, try using another window.
Display system call statistics HowtoDisplay the Current CoreDumpConfiguration ■ If possible, log in remotely from another system on the network. Use
$ sar –d $ coreadm -p $HOME/corefiles/%f.%p $$ the pgrep command to look for the hung process. If it looks like the
Display disk activity statistics Set a per-process core file name pattern window system is hung, identify the process and kill it.
$ sar –g # coreadm -g /var/corefiles/%f.%p 2. Press Control-\ to force a “quit” in the running program and
Display page-out and memory freeing activities in averages Set a global core file name pattern (probably) write out a core file.
$ sar –k # coreadm -e global -g /var/core/core.%f.%p 3. Press Control-c to interrupt the program that might be running.
Check Kernel Memory Allocation Enable a global core file path. 4. Log in remotely and attempt to identify and kill the process that is
$ sar –m $ /usr/proc/bin/pstack ./core hanging the system.
Check Interprocess Communication ExaminingCore Files With proc Tools
5. Log in remotely, become superuser or assume an equivalent role
and reboot the system.
6. If the system still does not respond, force a crash dump and reboot.
Stop-a , ok sync
7. If the system still does not respond, turn the power off, wait a minute
or so, then turn the power back on.
8. If you cannot get the system to respond at all, contact your local
service provider for help.

File SystemFills Up Because a Large File or Directory Was Created


Log in as superuser or assume an equivalent role and use the ls -tl
command in the specific file system to identify which large file is newly
created and remove it.

Troubleshooting File Access Problems


Solving ProblemsWith Search Paths (Command not found)
$ echo $PATH
Display the current search path to verify that the directory for the
command is not in your path
or that it isn't misspelled.
$ which command
Verify the new path.

You might also like