JAVA SCRIPT

RH033. 9. PROCESS





  Anything under execution is called process

  ps        =Shows process of current terminal
  ps -a     =Shows process of all terminal
  ps -au    =Shows process of all terminal + user who started process
  ps -x     =All background running process

  ps -au |grep tty3 -->show process of third terminal
  ps -au |grep suma -->show process started by user
  ps -au |grep yes  -->show process of any terminal where yes command running


  STATES OF PROCESS

  R  --> Running
  S  --> Interupptable sleep
  T  --> Stopped jobs
  D  --> Uninterruptable sleep 
  Z  --> Zombie state
  +  -->running in foreground
  -  -->running in background

 
  KILL/STOP PROCESS

  kill   -l         --->Show all signals to kill
  kill   -9  <pid>  --->Kill abruptly
  kill   -15 <pid>  --->Kill with warning message
  kill   -19 <pid>  --->Stop a process
  kill   -18 <pid>  --->Start a process

  TO SCHEDULE JOB AT PARTICULAR TIME

  date                      //Check for system date,lets assume its 10.12
  at   10:15                / you want to execute command at 10.15
  cal  > /dev/tty3         //want to execute cal in terminal 3
  ctrl d                   //save
 
  at  -l                //List scheduled jobs
  atrm                  //Remove all scheduled jobs

 TO SCHEDULE A JOB REPETEADLY

 1. * -->min
 2. * -->hour           
 3. * -->day
 4. * -->month
 5. * -->week

 crontab -e             //Opens a editor to schedule a job
 crontab -l             --> list all cronjobs
 crontab -r             --> Remove all cronjobs
 crontab -eu   <user1>  --> Set crontab to user1, as root

 EXAMPLES OF CRON JOB

 1. Execute hello @ 10.15
    15    10    *    *    *    echo "hello" 

 2. Execute date every 15 min in terminal 3
    /15    *     *    *    *    date > /dev/tty3

 3. Execute cal every 5th and 10th of EVERY month @ 10.15
    15    10     5,10    *    *   cal > /dev/tty2

 4. Execute cal between 5th to 10th of 1 and 3rd  01.20 p.m
    20    13     5-10    1,3    *   cal > /dev/tty2


   SCHEDULE PRIORITY OF JOB
 
  Nice command helps to set priority,priority ranges for -20 to +19

  nice  -n  -20  yes 123            --> yes command gets highest prority
  nice  -n  +10  firefox google.com --> browser Gets lowest prority

  ONLINE STATUS

  top -->shows online status of all running process
  f    ->customise fields of top
  k    ->kill process
  d    ->set delay
  r    ->renice priority of any job

  Executing unrelated commands together/grouping commands

  who;date            -->execute both date and who
 (who;date) > file1   -->redirect o/p of both command to file1

  EXIT STATUS

  exit status ranges from 0-255
  Anything other than 0 is set to be wrong commands

  echo $?  -->command to show exit status
    


If you found this post useful, I would really love it, if you can Like the Page, or share it with your Facebook/Google+/Twitter Friends... It will keep me motivated. Thank you!

No comments:

Post a Comment