|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Some unix hw help
Hey guys. A little stuck right now. I am taking a side class trying to learn basic unix. If anyone could help me out and walk me through this id very much appreciate it.
here is the question I believe this should be done using Cshell 1. write c program or script that sleeps for 15 minutes ( i believe issuing the sleep command will work) 2. issue ps command to show all the processes controlled by the terminal 3. Run the sleep script/cmd in the background 4.Issue ps command to show all proccesses controlled by terminal 5.mark the process running in the foreground and background 6. bring the background processes to the foreground 7. stop it using cntrl-z and issue ps command 8. Mark the status of all proccesses controlled by terminal 9. take the stopped processes to the background and issue the ps command 10. mark the process statuses 11. kill the background process and issue ps command. im so confused |
|
#2
|
||||
|
||||
|
I assume this is homework? Bloody good luck in getting #7 down on paper, LOL!
I would hope that by this stage in your course you would have been introduced to the man command, and given an introduction to basic command line usage. |
|
#3
|
|||
|
|||
|
gee thanks. yes i used the man command. I was hoping someone could walk me through this stuff. unix is a interesting OS
|
|
#4
|
||||
|
||||
|
Ok, got that all sorted ... now:
1) Use the man page for sleep 3) try putting an ampersand after the command to put in batch ... command &. 2), 4) and 8) are to show the system before and during the batch sleep command. 6) man page for fg And so on ... |
|
#5
|
|||
|
|||
|
can anyone else help? im confused to bloody hell.
|
|
#6
|
|||
|
|||
|
Since you are being asked to run ps commands to look for specific things that will (or will not) be there all these 'questions' would be done whilst logged in to the server in question.
1) Simple enough - a script will be dead easy and I suspect a C program almost as easy (I do not know C!). Code:
!/bin/sh # Calculate how many seconds in 15 minutes min15=$(( 15 * 60 )) # Issue the sleep command sleep $min15 Put that code in a script, make sure it is executable, and run it. 2) Now, and this will be annoying ... your session will lock whilst that command runs, so you will need to open up another session to to the ps in. Check the man page for what parameters you would need and/or for what info to look for. 3) Run the script from question 1) again, but put a space and an ampersand after the script name - that will put the command in batch. The rest of the questions involve either a ps command to show/prove the command running or not running, the rest involve controlling the running of the script in batch and foreground - the man pages for fg, bg, and kill will give you a clue I trust. |
|
#7
|
||||
|
||||
|
Quote:
Still confused? How did you get on with the assignment? Any special issues or problems you found in doing them? |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Some unix hw help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|