Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Shell Script to end process help Post 302304047 by NoobieBoobie on Saturday 4th of April 2009 03:57:36 PM
Old 04-04-2009
I fixed the echo $STIME thing.
The second one was to pick the second time. I noticed sometime it output two or three times... like there was two or three process of the same name running. I chose the second one because it always seem to have a lower time, meaning it's been running the longest.

Here's what I get when I run "sh -x assign1.sh bash 20"
Code:
 sh -x assign1.sh bash 20
+ test 2 -eq 2
timeout=20
+ echo 20
20
+ who am i
+ cut -f1 -d
USERNAME=std11
+ ps -u std11 -f
+ grep bash
+ awk -F  {print$5}
STIME=14:37:31
14:44:55
14:44:55
+ echo 14:37:31 14:44:55 14:44:55
+ awk -F  {print $2}
STIME=14:44:55
+ echo 14:44:55
+ awk -F: {print $1*60+$2}
STIME=884
+ ps -u std11 -f
+ grep bash
+ awk -F  {print$2}
PID=6304
6438
6428
+ echo 6304 6438 6428
+ awk -F  {print $2}
PID=6438
+ date
+ awk -F  {print $4}
current_time=14:44:54
+ 14:44:54
assign1.sh: 14:44:54: not found
+ awk -F: {print $1*60+$2}
current_time=
+ -884
assign1.sh: -884: not found
timediff=
assign1.sh: syntax error at line 26: `end of file' unexpected

It looks like my current_time became negative somehow???
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

end of file problem with shell script

My shell script was working ok with K shell. But all of sudden, it started acting crazy. it keeps saying this: syntax error at line 70 : `"' unmatched I don't even have 70 lines in my file or this : syntax error at line 69: `end of file' unexpected Can this file got... (5 Replies)
Discussion started by: whatisthis
5 Replies

2. Shell Programming and Scripting

How to add notes at the end of shell script

i was wondering how to add a notes section for the user to enter in a shell script, as my shell script is a menu based on configurations of hardware and software help is appreciated (4 Replies)
Discussion started by: zuberk
4 Replies

3. Shell Programming and Scripting

Help with shell script: moving end of line character

Hello. I have a file (old.txt) that I need to copy into another file (new.txt). Each line on old.txt ends with CR/LF but the position of CR/LF varies from one record to another. I need to copy each line of record to new.txt and move CR/LF in pos 165. Can I use awk to achieve this? How?... (8 Replies)
Discussion started by: udelalv
8 Replies

4. Shell Programming and Scripting

Shell Script to Kill Process(number of process) Unix/Solaris

Hi Experts, we do have a shell script for Unix Solaris, which will kill all the process manullay, it used to work in my previous env, but now it is throwing this error.. could some one please help me to resolve it This is how we execute the script (and this is the requirement) ... (2 Replies)
Discussion started by: jonnyvic
2 Replies

5. Shell Programming and Scripting

Kill a process from parent shell within a shell script

Hi, I am looking for a solution for the following problem: Im Using tcpdump within a shellskript started in a subshell by using brackets: ( /usr/sbin/tcpdump -i ... -c 1 ) - I want the outout of tcpdump saved in a variable - Than tcpdump-Process in the Subshell should be killed - and I... (6 Replies)
Discussion started by: 2retti
6 Replies

6. Shell Programming and Scripting

Shell script menu for end user - difficult challenge

Hello, I need to make shell script menu for my end users. There is like 100 scripts in system, and they need to run that scripts true one main script with user friendly menu. Example, when user will run main menu script, it will get something like this on his screen:... (3 Replies)
Discussion started by: waso
3 Replies

7. Shell Programming and Scripting

Shell script menu for end user - difficult challenge 2

Hello, I need to make shell script menu for my end users. There is like 100 scripts in system, and they need to run that scripts true one main script with user friendly menu. Example, when user will run main menu script, it will get something like this on his screen:... (1 Reply)
Discussion started by: waso
1 Replies

8. Shell Programming and Scripting

How does a shell script recognize the end of a line?

Hi friends , I want to know how does a shell script recognize the end of a line? . i have hunddres of proccedure to test where i want to ingnore the comments which starts with "--" .. it can start from the middle of the lines also. for example:: select * from table1; -- getting... (5 Replies)
Discussion started by: neelmani
5 Replies

9. Shell Programming and Scripting

Shell script to check line end not ending with comma

I have several line in a text file. for example I like apple; I like apple I like orange; Output: I like apple I try to useif grep -q "!\;$"; then (Not work) Please use CODE tags when displaying sample input, sample output, and code segments (as required by forum rules). (1 Reply)
Discussion started by: cmdcmd
1 Replies

10. UNIX for Beginners Questions & Answers

Spooling File to My Desktop From Back-end using shell script

Hello all, I am trying to spool a SQL query output file from back-end to desktop in a certain path but it didn't work,the query writes the output in a file in the same directory at the back-end. note : i use the same query in sql developper and file was created in the desired path fine code... (1 Reply)
Discussion started by: bmaksoud
1 Replies
rwsnoop(1m)							   USER COMMANDS						       rwsnoop(1m)

NAME
rwsnoop - snoop read/write events. Uses DTrace. SYNOPSIS
rwsnoop [-jPtvZ] [-n name] [-p PID] DESCRIPTION
This is measuring reads and writes at the application level. This matches the syscalls read, write, pread and pwrite. Since this uses DTrace, only users with root privileges can run this command. OPTIONS
-j print project ID -P print parent process ID -t print timestamp, us -v print time, string -Z print zone ID -n name process name to track -p PID PID to track EXAMPLES
Default output, # rwsnoop Print zone ID, # rwsnoop -.Monitor processes named "bash", # rwsnoop -n bash FIELDS
TIME timestamp, us TIMESTR time, string ZONE zone ID PROJ project ID UID user ID PID process ID PPID parent process ID CMD command name for the process D direction, Read or Write BYTES total bytes during sample FILE filename, if file based. Reads and writes that are not file based, for example with sockets, will print "<unknown>" as the file- name. DOCUMENTATION
See the DTraceToolkit for further documentation under the Docs directory. The DTraceToolkit docs may include full worked examples with ver- bose descriptions explaining the output. EXIT
rwsnoop will run forever until Ctrl-C is hit. AUTHOR
Brendan Gregg [Sydney, Australia] SEE ALSO
rwtop(1M), dtrace(1M) version 0.70 Jul 24, 2005 rwsnoop(1m)
All times are GMT -4. The time now is 03:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy