(a) Extend the code in Figure 14.5, 14.6, or 14.7 to try to kill processes more gently....
Question:
(a) Extend the code in Figure 14.5, 14.6, or 14.7 to try to kill processes more gently. You’ll want to read the man page for the standard kill command. Use a TERM signal first. If that doesn’t work, ask the user if you should resort to KILL.
(b) Extend your solution to part (a) so that the script accepts an optional argument specifying the signal to be used. Alternatives to TERM and KILL include HUP, INT, QUIT, and ABRT.
Figure 14.5:
Figure 14.6:
Figure 14.7:
Transcribed Image Text:
O || die "usage: $0 pattern\n"; open (PS, "ps -w -w -x -o'pid,command' I"); $#ARGV == # 'process status' command
O || die "usage: $0 pattern\n"; open (PS, "ps -w -w -x -o'pid,command' I"); $#ARGV == # 'process status' command ; # discard header line while () { @words = split; # parse line into space-separated words if (/$ARGV [O1/i && $words [0] ne $$) { chomp; print; # delete trailing newline do { print "? "; $answer = ; } until $answer if ($answer kill 9, $words [0]; # signal 9 in Unix is always fatal sleep 1; die "unsuccessful; sorry\n" if kill 0, $words [0]; /* [yn]/i; /"y/i) { # wait for 'kill' to take effect # kill 0 tests for process existence
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 69% (13 reviews)
answer a ARGV 0 die usage 0 pattern open PS ps wwx opid command 1 process status command discard header line while words split parse line into spacese...View the full answer
Answered By
Churchil Mino
I have been a tutor for 2 years and have experience working with students of all ages and abilities. I am comfortable working with students one-on-one or in small groups, and am able to adapt my teaching style to meet the needs of each individual. I am patient and supportive, and my goal is to help my students succeed.
I have a strong background in math and science, and have tutored students in these subjects at all levels, from elementary school to college. I have also helped students prepare for standardized tests such as the SAT and ACT. In addition to academic tutoring, I have also worked as a swim coach and a camp counselor, and have experience working with children with special needs.
0.00
0 Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
The code in Figure 8-24 should display the pattern of ampersands shown in the figure, but it is not working correctly. Debug the code. for (int row = 1; row < 4; row + 1) { for (int col = 1; col
-
Modify the code in Figure 5.32 to measure the following system characteristics. Plot the experimental results with elapsed time on the y-axis and the memory stride on the x-axis. Use logarithmic...
-
Consider a variation on the code in Figure 15.5, in which the string concatenation inside the while loop is reversed: str = foobar; i = str.search(/[aeiou]/); while (i != -1) {str = str.substring(0,...
-
What has been the trend in sales over the years presented? July 29, July 30, 2023 2022 (Unaudited) (Unaudited) Net sales $ 5,164,072 100.0% $ 4,643,014 100.0% Cost of sales 3,115,603 60.3% 2,773,824...
-
In a dairy plant, milk at 4C is pasteurized continuously at 72C at a rate of 12 L/s for 24 h/day and 365 days/yr. The milk is heated to the pasteurizing temperature by hot water heated in a natural...
-
Question 3 of 3 -/10 Hart Labs, Inc. provides mad cow disease testing for both state and federal governmental agricultural agencies. Because the company's customers are governmental agencies, prices...
-
(a) Who are StuffDOTs target markets and (b) what items are most likely to be Dotted by each of these user groups?
-
Ramakrishnan Inc. reported 2018 net income of $15 million and depreciation of $2,650,000. The top part of Ramakrishnan, Inc.'s 2018 and 2017 balance sheets is listed below (in millions of dollars)....
-
TB MC Qu. 01-158 (Algo) Using the information below... Using the information below, compute the raw materials inventory turnover: Multiple Choice 8.02 . 7.22 . 45.50 . 50.50 . 7.60
-
Maxwell Communications was organized on December 1 of the current year and had the following account balances at December 31, listed in tabular form: Early in January, the following transactions were...
-
Write a Perl, Python, or Ruby script that creates a simple concordance: a sorted list of significant words appearing in an input document, with a sublist for each that indicates the lines on which...
-
In Example 14.16 we used "$@" to refer to the parameters passed to ll. What would happen if we removed the quote marks? (Try this for files whose names contain spaces!) Read the man page for bash and...
-
For (x) = 3x and g(x) = [1/4] x , find each of the following. Round answers to the nearest thousandth as needed. (2.34)
-
Juanita Poblamo makes large ceramic pots for use in outdoor landscape. She currently has two models, one square and the other round. Because of the size of Juanitas creations, only one pot can be...
-
EPI educational products are currently sold without any supplemental materials. The company is considering the inclusion of instructional materials such as an overhead slide presentation, potential...
-
EPI is considering eliminating a product from its ToddleTown Tours collection. This collection is aimed at children one to three years of age and includes tours of a hypothetical town. Two products,...
-
Suppose we estimate the model y i = + u i , where u i N [ 0 , i 2 ] . (a) Show that the OLS estimator of simplifies to ^ = y . (b) Hence directly obtain the variance of y . Show that this...
-
This question presumes access to software that allows NLS and ML estimation. Consider the gamma regression model of Exercise 5-2. An appropriate gamma variate can be generated using \(y=-\lambda \ln...
-
A mineral sample has a mass of 5.94 g and a volume of 0.73 cm 3 . The mineral is either sphalerite (density = 4.0 g/cm 3 ), cassiterite (density 5 6.99 g/cm 3 ), or cinnabar (density = 8.10 g/cm 3 )....
-
Using Apple, demonstrate how the differentiation strategy can be well implemented.
-
Assume we want to connect two isolated hosts together to let each host communicate with the other. Do we need a link-layer switch between the two? Explain.
-
Can you explain why we did not mention multiplexing/demultiplexing services for the application layer?
-
The presentation of data is becoming more and more important in todays Internet. Some people argue that the TCP/IP protocol suite needs to add a new layer to take care of the presentation of data. If...
-
you are analyzing the cost of debt for a firm. Do you know that the firms 14 year maturity, 7.8 Percent coupon bonds are selling at a price of $834. The Barnes pay interest semi annually. If these...
-
***Please answer the following using excel and showcasing the formulas/calculations used*** thank you so much Financial information on AAA Ltd. is shown below. AAA Ltd. Income Statement For the Year...
-
2. In an account Anh Paglinawan currently has $216,670.00. At a rate of 8.00% how long will it take for them to have $298,390.00 assuming semi-annually compounding? (Hint: compute the exact years, do...
Study smarter with the SolutionInn App