Thursday, June 28, 2012

Daily Management



•/etc/passwd                                                                 Contains the basics of a user
•/etc/security/.profile                                                      Providing the user profile
•/etc/security/limits                                                        Contains all the ulimits, or users' system resource limitations
•/etc/security/passwd                                                     Contains the AIX user's password information
•/etc/security/user                                                          Contains the most important settings
•/usr/lib/security/mkuser.default                                       Contains values used when creating user through mkuser

# getconf LOGIN_NAME_MAX                                        To verify the setting in AIX 5.3 and later
# lsattr -El sys0                                                             To verify the setting in AIX 5.3 and later
# chdev -l sys0 -a max_logname=129                              To change the value of sys0

# mkuser xander                                                            To create a user with default settings
# finger xander                                                               Gives the short information of user
# chuser core=1048576 xander                                       To change the User attribute
# chsh xander                                                                To change the user login shell
# chfn xander                                                                 To change GECOS information
# lsuser -f xander                                                           List the user in stanza format
# passwd xander                                                            To set or change password of user
# passwd -f xander                                                         To change user GECOS using passwd command
# passwd -s xander                                                        To change the user SHELL using passwd
# rmuser xander                                                 Remove the user
# rmuser –p xander                                                        To remove fully user information

•/etc/group                                                                    Contains the basics of a group
•/etc/security/group                                                        Contains extended attributes to the specified group

# mkgroup atctest                                                          To create a group
# mkgroup -a atcadmin                                                   To create an admin group
# mkgroup adms=xander xangroup                                  To create a group and add Xander as the administrator of the group
# chgroup id=204 users=xander,atc,amdc xangroup          Change the group's GID and add users
# chgrpmem                                                                  Another way to modify a group's members is with chgrpmem
# chgrpmem xangroup                                                    List the group information
# chgrpmem -m - atc xangroup                                        Remove a user from a group
# lsgroup xangroup                                                         List the info of group
# lsgroup -f xangroup                                                      List info of group in stanza fromat
# rmgroup atctest                                                           Remove the group

•/etc/security/environ                                                      Contains the environment attributes for users
•/etc/security/lastlog                                                      Contains the last login attributes for users
•/usr/lib/security/mkuser.sys                                           Customizes new user accounts
•/etc/security/login.cfg                                                    Contains system default login parameters
•/etc/utmp                                                                     Contains a record of users logged into the system
•/var/adm/wtmp                                                              Contains connect-time accounting records
•/etc/security/failedlogin                                      Records all failed login attempts
•/etc/motd                                                                     Contains the message to be displayed every time user login
•/etc/environment                                                           Specifies the basic environment for all processes.
•/etc/profile                                                                    Specifies additional environment settings for all users.
•$HOME/.profile                                                             Specifies environment settings for a specific user.

# ps -ef                                                                         To display all processes
# ps -f -l -ujim                                                                To list processes owned by specific users
# ps -M                                                                         To list all the 64-bit processes

# kill 1095                                                                     To stop a given process
# kill -kill 2098 1569                                                       To stop several processes that ignore the default signal
# kill -kill 0                                                                     To stop all of your processes and log yourself off
# kill -9 -1                                                                      To stop all processes that you own

# fuser -u /etc/filesystems                                               List a process numbers and user login names of processes
# fuser -k -x -u -c /dev/hd1                                              To terminate all of the processes using a given file system
# fuser -kxuc /home                                                       To terminate all of the processes using a given file system
# fuser -d /usr                                                                To list all processes that are using a file that has been deleted from a given file system
# fuser -xc /tmp                                                             List open references within a specified file system
# find /home -type d -exec fuser -u {} \;                             Process is using a directory within the file system as its                                                                                       current working directory
# topas -i5 -n0 -p10                                                        To view the top 10 processes

The svmon command captures and analyzes a snapshot of virtual memory
The svmon command creates nine types of reports          
# svmon -G                                                                    Global Report
# svmon -U                                                                    User Report
# svmon -C                                                                    Command Report
# svmon -W                                                                   Workload Management Class Report
# svmon -T                                                                    Workload Management Tier Report
# svmon -P                                                                    Process Report
# svmon -S                                                                    Segment Report
# svmon -D                                                                    Detailed Report
# svmon -F                                                                    Framed Report

# aclget status                                                               To display the access control information of status file
# aclput -i acldefs status                                     To set the access control information of status from acldefs
# aclget plans | aclput status                                          To set the access control information of status from plans
# acledit plans                                                               To edit the access control information of the plans

#chown -R john:build /tmp/src                                         To change the owner & group of all files in the directory
# chmod 644 text                                                           To use the absolute mode
#chgrp -R staff proposals                                                Change the group ownership of the directory named                                                                                              proposals of dir stuff
# at -f filename -t CCYYMMDDhhmmSS Increment           Submit a job to be run at a later time
# at now -f appl/program > /dev/null 2>&1             To start at job now
# atq                                                                             List the at jobs
# at -r root.1134169200.a                                                Remove the at job
# ls /var/spool/cron/atjobs                                               Location of at jobs

# ls -l /var/spool/cron/crontabs                                         Location of cron jobs
# crontab -l                                                                    List the all cron jobs
# crontab -e                                                                   To edit crontab file
# crontab -v username                                                    Lists the status of the user's cron jobs
# crontab -r                                                                    Remove the crontab file
# crontab ~deploy/deploy.schedule                                  Runs the crontab file under user deploy

•/var/adm/cron/log                                                          The cron daemon logs file
•/var/adm/cron/cron.deny                                                Deny cron access to user for cron schedular
•/var/adm/cron/cron.allow                                                Allow cron access to user for cron schedular
•/var/adm/cron/at.allow                                                   Allow cron access to user for at schedular
•/var/adm/cron/at.deny                                                    Deny cron access to user for at schedular

# telinit                                                                          Directs the actions of the init process
# telinit M                                                                      Goes into the maintainance mode
# telinit q                                                                       Tell the init command to reprocess the /etc/inittab

Normally, you do not need to restart srcmstr. If the srcmstr daemon terminates abnormally, the respawn action specified in the /etc/inittab restarts the srcmstr  daemon.

A command is a request to perform an operation or run a program. A program or command that is actually running on the computer is referred to as a process.

The common types of processes are:
Foreground and background processes
Processes that require a user to start them or to interact with them are called foreground processes. Processes that are run independently of a user are referred to as background processes. Programs and commands run as foreground processes by default.

Daemon processes
Daemons are processes that run unattended. They are constantly in the background and are available at all times. Daemons are usually started when the system starts, and they run until the system stops. A daemon process typically performs system services and is available at all times to more than one task or user. Daemon processes are started by the root user or root shell and can be stopped only by the root user. For example, the qdaemon process provides access to system resources such as printers. Another common daemon is the sendmail daemon.

Zombie processes
A zombie process is a dead process that is no longer executing but is still recognized in the process table (in other words, it has a PID number). It has no other system space allocated to it. Zombie processes have been killed or have exited and continue to exist in the process table until the parent process dies or the system is shut down and restarted. Zombie processes display as <defunct> when listed by the ps command.

Ctrl-C                To intrrupt the process
Ctrl-Z                To stop process

# fg 589934                                                                   To bring the process in to the foreground
# find / -type f > dir.paths &                                             Run the find command in the background
# nohup find / -type f &                                       To run the find command and leave it running after you log off in Bg

0 Represents standard input (stdin)         <
1 Represents standard output (stdout)     > or >> (append)
2 Represents standard error (stderr)         2> or 2>> (append)
                                                            2>&1                Redirects stderr to stdout.
                                                            1>&2                Redirects stdout to stderr


Performance Monitoring

# nice -10 foo                                                     Add 10 to current nice value (Lower Priority)
# nice -n 10 foo                                                  Add 10 to current nice value (Lower Priority)
# nice - -10 foo                                                   Subtract 10 from current value (Higher Priority)
# nice -n -10 foo                                                 Subtract 10 from current value (Higher Priority)

# renice -10 –p 563                                            Add 10 to default nice value (Lower Priority)
# renice –n 10 –p 563                                         Add 10 to current nice value (Lower Priority)
# renice - -10 –p 563                                          Subtract 10 from default nice value (Higher Priority)
# renice –n -10 –p 563                                        Subtract 10 from current nice value (Higher Priority)

# ps –ekl                                                           Long listing of kernel processes with priority
# ps –L 483445 –l                                              It list the child the processes of parent process
# ps –kmo THREAD –p 16396                             It list the threads of particular processes

# schedo                                                           To change the CPU usage priority decay rate

Context Switch : A context switch is when one thread is taken off a CPU and another thread is despatched onto the same CPU.

User Mode : User mode is when thread is executing its own application code or shared library code. Time spent in user mode is reflected as %user time in output of commands such as vmstat, topas, iostat, sar.

System Mode : System Mode is when the CPU is executing code in the kernel. CPU time spent in kernel mode is reflected as system time in output of vmstat, topas, iostat, sar commands. Context switch time, system calls, device interrupts, NFS I/O, and anything else in the kernel is considered as system time.

# time                                                                           It show the elapsed time in system and user mode
# vmstat 5 3

# vmstat -f                                                                     To display fork statistics
# vmstat -s                                                                    To display count of various events

# sar –P ALL 5 1                                                            All CPU related usage
# sar –q 5 3                                                                   Queue details
# ps aux                                                                        Locating the dominant processes
# tprof –x sleep 60                                                         Reports processor usages                                             

# lparstat 2 3                                                                 System wide CPU report
# sar –P ALL 2 2                                                            Viewing CPU statistic with SMT
# sar -d 1 2                                                                    Disk I/O statistic
# smtctl                                                                                    To check SMT is enabled or not
# smtctl –m on –w now                                                   Tern on SMT immediately
# smtctl –m on –w boot                                                  Tern on SMT at next reboot
# bindprocessor –q                                                         To check logical CPU

# iostat                                                                         I/O device statistics


# iostat -d hdisk2 2                                                        Continuous disk report
# netstat                                                                       network statistic
# netstat -rn                                                                   Network routing table
# netstat -rs                                                                   Network routing statistic

CPU bound A system is said to be CPU-bound if the total system (sy) and user (us) CPU usage is approaching 100 percent. This would imply that idle time and wait time for CPU are approaching zero.

Memory bound A system is memory-bound if some virtual memory is forced out to disk, meaning the system is waiting on a relatively slow disk instead of relatively fast RAM. This is indicated by a non-zero value in the page-in (pi) and page-out (po) values.

Paging rate is the average number of page-ins and page-outs per CPU cycle.

Idle time calculation:
Total CPU Idle Time % = wait % + Idle Time %
Ex:
Average CPU Idle Time percentage = ((99+1) + (97+2) + (95+4) + (99+1))/4 = 99.5%


                       


No comments:

Popular Posts

Is this site helping you ?