Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
3_4_format.doc
Скачиваний:
0
Добавлен:
01.05.2025
Размер:
94.21 Кб
Скачать

2.5 Nohup command

To start the process in the background, you just need to type & after the command name, for example:

# cat / var / log / messages | grep fetchmail > fetchmail.log &

But if, for example, you use as a shell interpreter sh, and immediately after this command will leave the system command exit (or Ctrl + D), Larry send a signal to hang up (HUP) in this process (as, indeed, and all they generated ).

To prevent this from happening, you must run this command with the command nohup.

# nohup cat / var / log / messages | grep fetchma.il > fetchmail.log &

In this case, all clear signal from sh will be ignored.

But the team nohup has side effects: it increases the nice value by +5 if the standard output file is not overwritten, then all output will go to the file nohup.out (in our case, this does not happen).

Note. If you are using csh or other modern interpreters, then you can well do without the command nohup.

2.6 At command

The at command lets you specify what time to perform a given task. This command has the following syntax:

% at options time < scenario_file

The specified script file is transferred to the execution of a specified time, you can also enter a term directly from the team, completing the entry by pressing [CTRL-d]:

% at the time options

Team 1

Team 2

.......... .

[CTRL-d]

Redirecting input (<) is not required in the BSD and some other versions of UNIX.

Options at.

  • at-c - run the script using the interpreter C shell,

  • at-s - used for the same purpose Larry Bourne shell.

But the default command at the interpreter uses the shell, which user is logged on.

The command atq by default displays a list of all tasks that are included in the queue. Command atrm deletes tasks from the queue.

2.7 Program cron

The program allows you to plan your cron periodic execution of programs. For example, every hour interview given UUCP-site.

The program cron can send output job performed either in the registration file by redirecting, or the user via e-mail.

3 Control questions

  1. The components of the process.

  2. The concept of process.

  3. PID.

  4. Which team is used to manage processes?

  5. Which command is used to establish priority running process?

  6. What are the state of the process?

  7. What is the protection of background processes?

  8. How to start a job at a certain time?

4 Homework

  1. Examine the key provisions.

  2. Written reply to the control questions.

  3. Prepare for the lab assignments.

5 Laboratory assignment

  1. Determine what processes are running in the system.

  2. View all processes in an expanded form. (Man ps)

  3. On behalf of the user to send a signal to the completion of the process of init.

  4. Create an executable file.

cat> myprog.c

int main ()

{

while (1);

}

^ D

The program is written in C and should execute an infinite loop. Check out the source file to get an executable file, you need to invoke the compiler command:

gcc myprog. c - on myprog

If you do not make a mistake, it will create an executable file named myprog. Run this file. Go to another terminal and using the command top trace the state of the system. Abort process myprog.

  1. Run 4-6 copies of myprog in the background. Use the top look like a distributed CPU time. Change the attribute of NICE for any process and look at the reaction of the system.

  2. Set SUID bit on executable process and allow another user to start the process. See who is the owner of the running of the file with the SUID bit set and the unknown.

  3. Install the SUID bit for the file containing the script and see who will own the process.

  4. Make it so that myprog will follow in the pair.

  5. Make it so that myprog to do every Tuesday at 14.56.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]