Thursday, July 2, 2009

Controlling System Processes

Controlling System Processes


# /usr/dt/bin/sdtprocess & -- GUI tool for process monitoring

# prstat -- Displays info about active process (5 sec refresh interval)

Options for prstat command

-c --. Continuously prints new reports below previous reports
-n nproc -- Restricts the number of output lines
-p pidlist -- Reports only on process that have PID
-t -- Reports total usage summary for each users
-u euidlist -- Reports only processes that have an EUID in the given list
-U uidlist -- Reports only processes that have a real UID in the given list

# kill –signal PID
# pkill –signal process

# pgrep –l mail -- To know PID
# pkill sendmail -- To kill sendmail process

# ps –e | grep mail -- To know PID
# kill 314 -- To kill mail process

# kill signal PID PID PID
# pkill signal process process

Default signal is 15

1 SIGHUP Hnagup -- Stop & start with the same pid
2 SIGNT Interrupt --
9 SIGKILL Kill -- Kill forcibly
15 SIGTERM Terminate -- Kill properly


# pkill -1 (or) –HUP sendmail
# kill –SIGTERM (or) -15
# kill –SIGKILL (or) -9
# kill –SIGHUP (or) -1 (or) –HUP

# renice –n -10 195 -- To change priority
-20 -- Highest priority for a process
0 -- Neutral priority
+20 -- Least priority

# psrinfo -- shows how long the system is running

# ps –e -- Shows all system process
# ps –ef -- Default process details with command or service name
# ps –ef | grep cron -- To view specific process

# at 9:00 pm
at> find /export/home/user2 –name core rm {} \;
at> Ctrl+D
# at now
at> banner “welcome” > /dev/pts/4
at> ctrl+d
#

# at –l 1016078400.a -- Reports jobs schedule

# atq -- Shows the at jobs queue

# ls –l /var/spool/cron/atjobs -- Directory contains the at jobs

# at –r 1016078400.a -- To remove the at job

/etc/cron.d/at.deny -- We can add username to this file to deny access to at jobs
/etc/cron.d/at.allow -- We can add username to this file to allow access to at jobs
If neither file at.allow & at.deny file does not exist only the root user can use the at command.

Crontab File Format
0-59 0-23 1-31 1-12 1-7
Min Hour Date Month Days

# crontab –l -- View content of user crontab file
# crontab –e -- Editing the file
30 17 * * 5 /usr/bin/banner “Time to go!” > /dev/console

# crontab –r username -- Remove a crontab file

/etc/cron.d/cron.deny -- Users in this file will deny access to use crontab command
/etc/cron.d/cron.allow -- Users in this file will allow access to use crontab command

If we type only crontab as the command. It will go to process so if we press Ctrl+c then it won’t save the file but existing data will be present. When we press Ctrl+D then all the content will get deleted.

# crontab /root_cron -- To use a backup file for cron jobs.

# /etc/init.d/cron stop (or) start

# /var/spool/cron/crontabs -- Directory where users crontab schedule files are getting stored.

# /var/spool/cron/atjobs -- Directory where AT jobs get saved

# svcadm enable (or) disable cron

No comments:

Custom Search

Feeds from my other blog

Samsung S2 Brand new for 25900 White piece sealed box

For Sale, Mobile Phones - Accessories in India, Andhra Pradesh, Hyderabad. Date September 17

For Sale in Hyderabad