Scripting language can reduce a lot of manual operation, as a Linux programmer should understand the simple script to replace the manual operation, I also long ago to learn a lot of scripts, probably more than a year has not written, now only remember some basic grammar.
To talk about my needs, I wrote a loop queue interface, and then wrote a test program to test the loop queue, and now I want the test program to execute a number of times to see if there is a segment error (resulting in a core file) to test the stability of the loop queue interface.
The program now executes the directory input ulimit-c Unlimited to make the program produce a segment error when you can produce a core file for debugging later.
A simple procedure for scripting is attached below.
1. Script to start the test program (RUNQUEUE.SH)
The purpose of this script is: As long as the queue program exits on startup, execute 50 times
1 #!/bin/bash23for1; C + +))4do 5 'runqueue shell start ' ; 6 . /Queue7done
2. The script that kills the test program (KILLQUEUE.SH) has been tested to find that the queue process has been executed for about three minutes, so the killqueue.sh cycle sleep time is set to 4 minutes.
The purpose of this script is: Kill the queue program every 4 minutes, execute 50 times
1 #!/bin/bash 2 3 for ((c = 1 ; C <= 50 ; C++ 4 Do 5 echo " kill Queue shell start " 6 Sleep Span style= "color: #800080;" >240 7 8 kill-9 pidof queue ' 9 done
The reason I don't write two scripts is because when I write a script I find that the command to kill the process after the script starts the test program is unsuccessful, automatically switches to the queue process, and the script no longer executes the subsequent statements.
Use scripting to improve productivity