[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
slackbook:process_control [2012/09/08 19:44 (UTC)] – [top] updated section to match original text and formatting mfillpot | slackbook:process_control [2012/10/02 00:22 (UTC)] – [cron] removed base xml mfillpot | ||
---|---|---|---|
Line 17: | Line 17: | ||
- | < | + | < |
darkstar:~$ ps | darkstar:~$ ps | ||
PID TTY TIME CMD | PID TTY TIME CMD | ||
Line 45: | Line 45: | ||
- | < | + | < |
darkstar:~$ ps -e | darkstar:~$ ps -e | ||
PID TTY TIME CMD | PID TTY TIME CMD | ||
Line 71: | Line 71: | ||
< | < | ||
This is distinct from the //-aux// argument, but in most cases | This is distinct from the //-aux// argument, but in most cases | ||
- | the two arguments are equivilant. This is a decades-old relic. For more | + | the two arguments are equivalent. This is a decades-old relic. For more |
information, | information, | ||
</ | </ | ||
- | < | + | < |
darkstar:~$ ps aux | darkstar:~$ ps aux | ||
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND | USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND | ||
Line 103: | Line 103: | ||
- | < | + | < |
darkstar:~$ ps -o cmd -o etime $$ | darkstar:~$ ps -o cmd -o etime $$ | ||
CMD | CMD | ||
Line 122: | Line 122: | ||
- | < | + | < |
darkstar:~$ ps -o cmd -o rss -o vsz $(pgrep httpd) | darkstar:~$ ps -o cmd -o rss -o vsz $(pgrep httpd) | ||
CMD | CMD | ||
Line 155: | Line 155: | ||
- | < | + | < |
darkstar:~$ ps -ejH | darkstar:~$ ps -ejH | ||
... many lines omitted ... | ... many lines omitted ... | ||
Line 186: | Line 186: | ||
- | < | + | < |
darkstar:~$ pstree | darkstar:~$ pstree | ||
init-+-atd | init-+-atd | ||
Line 244: | Line 244: | ||
- | < | + | < |
darkstar:~$ kill -l | darkstar:~$ kill -l | ||
1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL | 1) SIGHUP 2) SIGINT 3) SIGQUIT 4) SIGILL | ||
Line 267: | Line 267: | ||
- | < | + | < |
darkstar:~$ killall bash # SIGTERM | darkstar:~$ killall bash # SIGTERM | ||
darkstar:~$ killall -s 9 bash # SIGKILL | darkstar:~$ killall -s 9 bash # SIGKILL | ||
Line 285: | Line 285: | ||
- | < | + | < |
darkstar:~$ top | darkstar:~$ top | ||
top - 16:44:15 up 26 days, 5:53, 5 users, | top - 16:44:15 up 26 days, 5:53, 5 users, | ||
Line 321: | Line 321: | ||
===== cron ===== | ===== cron ===== | ||
- | Ok, so we've learned many different ways of viewing the active processes on our system and means of signalling them, but what if we want to run a process periodically? | ||
- | In order to run programs from cron, you'll need to use the crontab(1). The man page lists a variety of ways to do this, but the most common method is to pass the [-e] argument. This will lock the user's entry in the cron database (to prevent it from being overwritten by another program), then open that entry with whatever text editor is specified by the VISUAL environment variable. On Slackware systems, this is typically the vi editor. You may need to refer to the chapter on vi before continuing. | ||
- | The cron database entries may seem a little archaic at first, but they are highly flexible. Each uncommented line is processed by crond and the command specified is run if all the time conditions match. | + | Ok, so we've learned many different ways of viewing the active |
+ | processes on our system and means of signalling them, but what if we | ||
+ | want to run a process periodically? | ||
+ | just the thing, **//crond//**(8). cron runs | ||
+ | processes for every user on the schedule that user demands. This makes | ||
+ | it very useful for processes that need to be run periodically, | ||
+ | don't require full daemonization, | ||
+ | gets their own entry in the cron database, so non-root users can | ||
+ | periodically run processes too. | ||
- | < | + | |
+ | In order to run programs from cron, you'll need to use the | ||
+ | **// | ||
+ | ways to do this, but the most common method is to pass the | ||
+ | //-e// argument. This will lock the user's entry in the cron | ||
+ | database (to prevent it from being overwritten by another program), | ||
+ | then open that entry with whatever text editor is specified by the | ||
+ | VISUAL environment variable. On Slackware systems, this is typically | ||
+ | the **//vi//** editor. You may need to refer to the | ||
+ | chapter on **//vi//** before continuing. | ||
+ | |||
+ | |||
+ | The cron database entries may seem a little archaic at first, but they | ||
+ | are highly flexible. Each uncommented line is processed by | ||
+ | **// | ||
+ | all the time conditions match. | ||
+ | |||
+ | |||
+ | < | ||
darkstar:~$ crontab -e | darkstar:~$ crontab -e | ||
# Keep current with slackware | # Keep current with slackware | ||
Line 333: | Line 357: | ||
</ | </ | ||
- | As mentioned before, the syntax for cron entries is a little difficult to understand at first, so let's look at each part individually. From left to right, the different sections are: Minute, Hour, Day, Month, Week Day, and Command. Any asterisk ***** entry matches every minute, hour, day, and so on. So from the example above, the command is //"/ | ||
- | crond will also e-mail the local user with any output the command generates. For this reason, many tasks have their output redirected to ///dev/null//, a special device file that immediately discards everything it receives. In order to make it easier for you to remember these rules, you might wish to paste the following commented text at the top of your own cron entries. | + | As mentioned before, the syntax for cron entries is a little difficult |
+ | to understand at first, so let's look at each part individually. From | ||
+ | left to right, the different sections are: Minute, Hour, Day, Month, | ||
+ | Week Day, and Command. Any asterisk < | ||
+ | every minute, hour, day, and so on. So from the example above, the | ||
+ | command is //"/ | ||
+ | it runs every weekday or every week of every month at 2:30 a.m. | ||
+ | |||
+ | |||
+ | **//crond//** will also e-mail the local user with | ||
+ | any output the command generates. For this reason, many tasks have | ||
+ | their output redirected to '' | ||
+ | device file that immediately discards everything it receives. In order | ||
+ | to make it easier for you to remember these rules, you might wish to | ||
+ | paste the following commented text at the top of your own cron entries. | ||
+ | |||
+ | |||
+ | <code bash> | ||
- | < | ||
# Redirect everything to /dev/null with: | # Redirect everything to /dev/null with: | ||
# | # | ||
Line 344: | Line 383: | ||
</ | </ | ||
- | By default, Slackware includes a number of entries and comments in root's crontab. These entries make it easier to setup periodic system tasks by creating a number of directories in /etc corresponding to how often the tasks should run. Any script placed within these directories will be run hourly, daily, weekly, or monthly. The names should be self-explanatory: | + | |
+ | By default, Slackware includes a number of entries and comments in | ||
+ | root's crontab. These entries make it easier to setup periodic system | ||
+ | tasks by creating a number of directories in '' | ||
+ | corresponding to how often the tasks should run. Any script placed | ||
+ | within these directories will be run hourly, daily, weekly, or monthly. | ||
+ | The names should be self-explanatory: | ||
+ | '' | ||
+ | '' | ||
+ | '' | ||
+ | '' | ||
+ | |||
+ | ====== Chapter Navigation ====== | ||
+ | |||
+ | **Previous Chapter: [[slackbook: | ||
+ | |||
+ | **Next Chapter: [[slackbook: | ||
====== Sources ====== | ====== Sources ====== | ||
<!-- If you copy information from another source, then specify that source --> | <!-- If you copy information from another source, then specify that source --> | ||
- | * Original source: [[http:// | + | * Original source: [[http:// |
<!-- Authors are allowed to give credit to themselves! --> | <!-- Authors are allowed to give credit to themselves! --> | ||
- | < | + | * Originally written by Alan Hicks, Chris Lumens, David Cantrell, Logan Johnson |
<!-- * Contrbutions by [[wiki: | <!-- * Contrbutions by [[wiki: | ||