Process/Job Control Commands

Unix  

Process/Job Control Commands

ps : gives current process status


kill : used to terminate process


bg : runs the job in the background


fg : runs the job in foreground


top : displays top Linux tasks, which are currently running,  stopped, and sleeping

cron : used to schedule jobs


Cron Table Format
*    *    *   *    *  Command_to_execute
|    |    |    |   |      
|    |    |    |    Day of the Week ( 0 - 6 ) ( Sunday = 0 )
|    |    |    |
|    |    |    Month ( 1 - 12 )
|    |    |
|    |    Day of Month ( 1 - 31 )
|    |
|    Hour ( 0 - 23 )
|
Min ( 0 - 59 )

To Install or update job in crontab, use -e option
$ crontab -e

To List Crontab entries, use -l option:
$ crontab -l
To Deinstall job from crontab, use -r option:
$ crontab -r
To Confirm Deinstall of job from crontab, use -i option:
$ crontab -i -r
To add SELINUX security to crontab file, use -s option:
$ crontab -s
To edit other user crontab, user -u option and specify username:
$ crontab -u username -e
To List other user crontab entries:
$ crontab -u username -l
EX :
To run /usr/bin/sample.sh at 12.59 every day and suppress the output
59 12 * * * simon /usr/bin/sample.sh > /dev/null 2>&1
To run sample.sh everyday at 9pm (21:00)
0 21 * * * sample.sh 1>/dev/null 2>&1
To run sample.sh every Tuesday to Saturday at 1am (01:00)
0 1 * * 2-7 sample.sh 1>/dev/null 2>&1
at :at command is a command-line utility that is used to schedule a command to be executed at a particular time in the future. Jobs created with at command are executed only once.
Schedule a job for the coming Monday at a time twenty minutes later than the current time:
at Monday +20 minutes

Schedule a job to run at 1:45 Aug 12 2020:
at 1:45 081220

Schedule a job to run at 3pm four days from now
at 3pm + 4 days

Schedule a job to shutdown the system at 4:30 today:
# echo "shutdown -h now" | at -m 4:30

Schedule a job to run five hour from now:
at now +5 hours


NIce :Nice command is used to set the priority with the range of -20 to 19 . -20 is the maximum highest priority and 19 is the lowest priority.
renice -4 -p 3423 →  (this will set the priority of process id no 3423 to -4, which will inturn increase its priority over others)
renice 13 -p 3564 -u sarath →  (this will set the priority of the process id 3564 to 13, and all the process owned by user "sarath" to the priority of 13)
renice 14 -u sarath,satish -g → custom (this will set all process owned by "sarath","satish" and also the group "custom" to 14)


Comments

Popular posts from this blog

Information Commands

Miscellaneous and Shell Programing Commands