Sponsored Content
Top Forums Shell Programming and Scripting Problem with writing into a file through shell script Post 302524843 by joydeep4u on Tuesday 24th of May 2011 09:18:36 PM
Old 05-24-2011
Problem with writing into a file through shell script

Hi all,

I have a shell script which I use to login to the server from the client and then from the server I run a bunch of other scripts to complete my task. I am having problems with the script below-
Code:
#!/bin/bash

while read line
do
connections=`echo $line | cut -d " " -f 1`
period=`echo $line | cut -d " " -f 2`
testcaseid=`echo $line | cut -d " " -f 3`

ssh  192.168.1.202 <<EOF
sudo ./collectlcpu.sh $period $connections $testcaseid&
#sudo ./oprofile.sh $period $connections $testcaseid
sudo ./interrupt.sh $period $connections $testcaseid
#sleep 10
exit
EOF

./httperf1.sh $period $connections $testcaseid&
sleep 12

ssh  192.168.1.202  <<EOF
sudo killall collectl
sudo killall collectlcpu.sh
sudo killall interrupt.sh
sudo opcontrol --shutdown
sudo killall oprofile.sh
#killall pfmon.sh
#killall pfmon
exit
EOF
done  <  "/home/joydeep/input.txt"

sleep 30

The interrupt script is given below-
Code:
#!/bin/bash

dt=`date +%m%d%l%M`
dtstring=`echo $dt|sed 's/ //g'`

period=$1
connections=$2
testcaseid=$3
echo "STARTING THE INTERRUPT SCRIPT"
outputfile0="output_period_""Core2_""$period""_""connections""_""$connections""_""$testcaseid""_""$dtstring"".txt"
outputfile2="output_period_""Core0_""$period""_""connections""_""$connections""_""$testcaseid""_""$dtstring"".txt"
for i in 1 2 3 4 5 6 7 8 9 10 11 12
do
line1=`cat /proc/interrupts | grep eth3-TxRx-0`
line2=`cat /proc/interrupts | grep eth2-TxRx-0`
nohup echo $line1 >> /home/joydeep/results/interrupt/samesocket/data_cache_misses/"$outputfile0"&
nohup echo $line2 >> /home/joydeep/results/interrupt/samesocket/data_cache_misses/"$outputfile2"&
sleep 1
done
echo "END OF THE INTERRUPT SCRIPT"

The problem is that the script is not writing the files in /home/joydeep/results/interrupt.

Thanks,
Joydeep

Last edited by Franklin52; 05-25-2011 at 07:20 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies

2. UNIX for Dummies Questions & Answers

HELP! writing shell script with c++ file

how would i write a shell script to count number of one-line comments in a c++ file. please help with coding thank you. (1 Reply)
Discussion started by: deadleg
1 Replies

3. Shell Programming and Scripting

Shell script for a writing the directory structure to a file

Hi All, I am new user of shell scripting has come up with a problem. that I have a directory structure like : Home | |--------A | |----trunk | |-------A_0_1/ | | | |-------A_0_2/ | |--------B | ... (6 Replies)
Discussion started by: bhaskar_m
6 Replies

4. Shell Programming and Scripting

Script writing problem

Self professed idot looking for help LOL Hi all, I am new to Unix and I have to write a shell script that will check to see if a file exist and then create it if it does not. The file I need to search for is titled "A1. dat" and here is my feeble attempt at creating the script: #!/bin/bash... (2 Replies)
Discussion started by: Tinablue
2 Replies

5. Shell Programming and Scripting

Shell Script to remove spaces while writing to the file

Hello Folks, I want to get the results from a SQL query which needs to be exported to a .txt file. My Script is something like #!/bin/ksh db2 connect to DATABASE user user_name using pwd; touch test.txt isResult=0; isResult= `db2 -x select 'ABC',COL_B from TABLE_A WHERE COL_B=CONDITION`... (6 Replies)
Discussion started by: dinesh1985
6 Replies

6. Shell Programming and Scripting

Help with writing shell script file

I am trying to prompt the user using tput command to read the information ( 5 last names, first names and grades) from the keyboard. Save the data in a file called student.txt. Sort the file by last name and display it on the screen My pseudocode is as follow: Pseudocode: Initialize... (1 Reply)
Discussion started by: jestaton
1 Replies

7. Shell Programming and Scripting

newbie: writing ksh shell problem

my default profile is using ksh, I tried to write a simple scripts and I had issues, below is my scripts: $ more if_num.ksh USAGE="usage: if_num.ksh" print -n "Enter two numbers: " read x y if ((x=y)) then print "You entered the same number twice." when I tried to executed the... (6 Replies)
Discussion started by: matthew00
6 Replies

8. Shell Programming and Scripting

problem writing a simple c shell script

#!/bin/csh echo hello world this is what i got in a text file called ss1. i type "chmod 755 ss1.txt" to make it executable. then when i type ss1 or ss1.txt it says "ss1 command not found" what am i doing wrong? (19 Replies)
Discussion started by: pantelis
19 Replies

9. Shell Programming and Scripting

Sqlplus inside shell script writing to tmp file

Hi, facing an issue while calling sqlplus inside shell script. It for some reason goes to tmp file to write something and i get error as permission denied as i dont have access there. ANy idea why sqlplus writes in /tmp and how to change or stop this ? (2 Replies)
Discussion started by: rushikeshs
2 Replies

10. Programming

Writing a UNIX shell script to call a C function and redirecting data to a .txt file

Hi, I am complete new to C programming and shell scripting. I just wrote a simple C code to calculate integral using trapezoid rule. I am prompting user to pass me No. of equally spaced points , N , upper and lower limit. My code looks as follows so far: #include<stdio.h> #include<string.h>... (2 Replies)
Discussion started by: bjhjh
2 Replies
uudemon(4)						     Kernel Interfaces Manual							uudemon(4)

NAME
uudemon.admin, uudemon.cleanu, uudemon.hour, uudemon.poll - Administrative shell scripts for polling remote systems, cleaning up spool directories, reporting status to the system administrator, and routine invocations of the uuxqt and uusched daemons SYNOPSIS
These shell scripts reside in the following directory: /usr/lib/uucp DESCRIPTION
All the scripts can be run from the command line or can be run automatically by the cron daemon. To automatically run the scripts, remove the comment character (#) from the beginning of the relevant line in the /var/spool/cron/crontabs/uucp file. This script reports status to the system administrator. It issues the uustat command to find out the status of uucp jobs. It mails the results to the uucp login ID. The script may be modified to send mail to any login ID such as the uucp administrative login ID (uucpa) or root. This script cleans up the /var/spool/uucp and /var/spool/uucppublic directories by running the uucleanup command. The uucleanup com- mand is run with the following parameters: -C7, -D7, X2, -o2, -W1. This script runs the uusched and uuxqt daemons in the background. This script polls the systems listed in the /usr/lib/uucp/Poll file. The uudemon.poll script should be scheduled before the uudemon.hour script. This allows uudemon.poll to create any command files before cron runs the uudemon.hour script. FILES
Contains the uudemon.admin, uudemon.cleanu, uudemon.hour and uudemon.poll files. Contains the uucp file. RELATED INFORMATION
Commands: cron(8), uucleanup(8), uusched(8), uuxqt(1) Files: /usr/lib/uucp delim off uudemon(4)
All times are GMT -4. The time now is 12:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy