Sponsored Content
Full Discussion: Processes Lab
Homework and Emergencies Homework & Coursework Questions Processes Lab Post 302778147 by Jagst3r21 on Saturday 9th of March 2013 10:18:46 PM
Old 03-09-2013
Processes Lab

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:

Here are my directions. I am pretty sure I am doing this right, but I just want someone more experienced to look over my work. Thank you.

There are two parts. It seems long but it's not. For both I need to record my inputs into a script file :

Part 1:

1) Start the command "sleep 6000" in the background
2) Use ps to determine its status
3) Redirect the ps command to a file
4) Kill the sleep process
5) Run ps to verify the process is dead.

Part 2: (Working with multiple processes)

1) Start up "sleep 6000" in the background
2) Start up "sleep 3000" with nohup in the background
3) Bring "sleep 6000" to the foreground
4) Suspend "sleep 6000"
5) Use ps or jobs to verify the state of all processes
6) Send a copy of ps to a file and print it
7) Kill both processes

2. Relevant commands, code, scripts, algorithms:

The relevant commands would be those located under processes, since that is the section we are working on now.


3. The attempts at a solution (include all code and scripts):

First I do "touch lab5file" to create a file, then I do "script lab5" to record my inputs (My teacher wants one script file for both parts - he does not want the output, just commands)

Part 1:

1. sleep 6000 &
2 + 3. ps > /var/home/stud3/jgeiger/lab5file
4. kill -9 <PID number here>
5. ps

Part 2:

1. sleep 6000 &
2. nohup sleep 3000 &
3. fg %<job number for sleep 6000 here>
4. ctrl + z
5 + 6. ps > /var/home/stud3/jgeiger/lab5file
7. kill -9 <PID number for sleep 6000>
8. kill -9 <PID number for sleep 3000>

4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

Brookdale Community College - Lincroft, New Jersey - United States - Dr. Rick Bournique- COMP 145

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

Last edited by Jagst3r21; 03-09-2013 at 11:26 PM.. Reason: course link
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

VMWare Workstation for home lab

I was wondering if anyone has used VMWare Workstation? I wanted to practice and learn Unix in a networking environment and have my own home lab. However room and money prevent me from buying several computers to do so. Any input would help thank you. (0 Replies)
Discussion started by: vedder191
0 Replies

2. Programming

Shell Script Lab

In the following Shell Script can anyone help me? What are the total scripts? What are the total binaries? What are the total files? #!/bin/sh GREP="/bin/grep -q" if ; then if ; then for | in ${I}/* ;do file ${I} | ${GREP} "executable" && echo "${I} is a binary" file ${I} |... (1 Reply)
Discussion started by: rktompsett
1 Replies

3. Shell Programming and Scripting

cant complete lab ???

heres the lab i did everything but when i issue the automated lab check. but it gives me this everytime ''you are missing the /home/smichaels/Labs/lab2b/group file, please create it as per step 12 of the lab. once you have corrected this problem, re-run the uli101.023 program'' im... (1 Reply)
Discussion started by: ink
1 Replies

4. Homework & Coursework Questions

Help completing lab.

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: ''you are missing the /home/smichaels/Labs/lab2b/group file, please create it as per step 12 of the lab. once... (4 Replies)
Discussion started by: ink
4 Replies

5. Homework & Coursework Questions

shell scripting while loop lab 15 help

hi.. this is shell scripting lab15.sh i dont understand this lab i am at the screen shot part. i was wondering if someone can take a quick look at this lab i have linked the doc below. i dont know where to start i have did the Required Errorlevels Errorlevel # but dont... (1 Reply)
Discussion started by: beerpong1
1 Replies

6. Shell Programming and Scripting

help me with lab im new to bash....

Write a script that copies the file tree (including subdirectories) in your home directory. As the initial directory to take the directory / usr / share / doc, as the destination directory using the directory $ {HOME} / doc. Write a script corresponding to paragraph 1. Additional conditions: a)... (1 Reply)
Discussion started by: elginmulizwa
1 Replies

7. Hardware

Electricity Savings for home lab

So, I have a kindof off the wall question. I've got 10 computers which I inherited from a charter school that closed that I did their admin work for. They're not servers, just workstations with ubuntu server running on them. I had them all up and running at one point... but crimineys the load on my... (8 Replies)
Discussion started by: jtollefson
8 Replies

8. Homework & Coursework Questions

Lab ^

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Filter a file for lines that have exactly 5 numbers in a row. 2. Relevant commands, code, scripts,... (13 Replies)
Discussion started by: herb bertz
13 Replies

9. Homework & Coursework Questions

System Admin. Lab

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Create a group id with your last name. Create 2 user IDs using your last name and the numbers 1 and 2. For each... (3 Replies)
Discussion started by: Jagst3r21
3 Replies

10. Hardware

Lab server organized software

Hello, Do you have any suggestion of any tool (web based preferably) about how to organize a lab environment? Now i save some info in excel sheet (one rack per column) , but i was thinking if any software exists. Thanks in advance! (2 Replies)
Discussion started by: @dagio
2 Replies
wait(1) 							   User Commands							   wait(1)

NAME
wait - await process completion SYNOPSIS
/bin/sh wait [pid]... /bin/jsh /bin/ksh /usr/xpg4/bin/sh wait [pid]... wait [% jobid...] /bin/csh wait ksh93 wait [job...] DESCRIPTION
The shell itself executes wait, without creating a new process. If you get the error message cannot fork,too many processes, try using the wait command to clean up your background processes. If this doesn't help, the system process table is probably full or you have too many active foreground processes. There is a limit to the number of process IDs associated with your login, and to the number the system can keep track of. Not all the processes of a pipeline with three or more stages are children of the shell, and thus cannot be waited for. /bin/sh, /bin/jsh Wait for your background process whose process ID is pid and report its termination status. If pid is omitted, all your shell's currently active background processes are waited for and the return code is 0. The wait utility accepts a job identifier, when Job Control is enabled (jsh), and the argument, jobid, is preceded by a percent sign (%). If pid is not an active process ID, the wait utility returns immediately and the return code is 0. csh Wait for your background processes. ksh When an asynchronous list is started by the shell, the process ID of the last command in each element of the asynchronous list becomes known in the current shell execution environment. If the wait utility is invoked with no operands, it waits until all process IDs known to the invoking shell have terminated and exit with an exit status of 0. If one or more pid or jobid operands are specified that represent known process IDs (or jobids), the wait utility waits until all of them have terminated. If one or more pid or jobid operands are specified that represent unknown process IDs (or jobids), wait treats them as if they were known process IDs (or jobids) that exited with exit status 127. The exit status returned by the wait utility is the exit status of the process requested by the last pid or jobid operand. The known process IDs are applicable only for invocations of wait in the current shell execution environment. ksh93 wait with no operands, waits until all jobs known to the invoking shell have terminated. If one or more job operands are specified, wait waits until all of them have completed. Each job can be specified as one of the following: number number refers to a process ID. -number number refers to a process group ID. %number number refers to a job number %string Refers to a job whose name begins with string %?string Refers to a job whose name contains string %+ Refers to the current job %% %- Refers to the previous job If one ore more job operands is a process id or process group id not known by the current shell environment, wait treats each of them as if it were a process that exited with status 127. OPERANDS
The following operands are supported: pid The unsigned decimal integer process ID of a command, for which the utility is to wait for the termination. jobid A job control job ID that identifies a background process group to be waited for. The job control job ID notation is applicable only for invocations of wait in the current shell execution environment, and only on systems supporting the job control option. USAGE
On most implementations, wait is a shell built-in. If it is called in a subshell or separate utility execution environment, such as one of the following, (wait) nohup wait ... find . -exec wait ... ; it returns immediately because there is no known process IDs to wait for in those environments. EXAMPLES
Example 1 Using A Script To Identify The Termination Signal Although the exact value used when a process is terminated by a signal is unspecified, if it is known that a signal terminated a process, a script can still reliably figure out which signal is using kill, as shown by the following (/bin/ksh and /usr/xpg4/bin/sh): sleep 1000& pid=$! kill -kill $pid wait $pid echo $pid was terminated by a SIG$(kill -l $(($?-128))) signal. Example 2 Returning The Exit Status Of A Process If the following sequence of commands is run in less than 31 seconds (/bin/ksh and /usr/xpg4/bin/sh): sleep 257 | sleep 31 & jobs -l %% then either of the following commands returns the exit status of the second sleep in the pipeline: wait <pid of sleep 31> wait %% ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of wait: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. EXIT STATUS
ksh93 The following exit values are returned by the wait built-in in ksh93: 0 wait was invoked with no operands. All processes known by the invoking process have terminated. 127 job is a process id or process group id that is unknown to the current shell environment. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |Standard |See standards(5). | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), jobs(1), ksh(1), ksh93(1), sh(1), attributes(5), environ(5), standards(5) SunOS 5.11 13 Mar 2008 wait(1)
All times are GMT -4. The time now is 10:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy