System call using awk on Solaris


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting System call using awk on Solaris
# 1  
Old 02-01-2011
Question System call using awk on Solaris

I'm brand new to awk and need your help.

I want to be able to shut down my workstations when they become to hot (because we've lost our cooling). I found a really neat way to monitor the temperature of the system and a short, simple awk scipt to use with it:
Code:
/usr/sbin/prtpicl -v -c temperature-sensor  and 
the awk program 

/:Temp/ {temp=$2}
/:name/ {if (($2=="cpu0") && (temp > 70)) <action>}

Which runs fine, but I can't get a system() call to work. It always hangs or does nothing. I, of course, want to run the init(0) command.

Thanks in advance,
RogerSmilie

Last edited by Franklin52; 02-02-2011 at 03:24 AM.. Reason: Please use code tags, thank you
# 2  
Old 02-01-2011
Try using nawk or /usr/xpg4/bin/awk instead of plain/old 'awk'.
# 3  
Old 02-01-2011
My apologies: I tried using /usr/xpg4/bin/awk, nawk and gawk and some function call with "///" in and such.

Thanks,
RogerSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using sed inside system call in awk

HI , I am trying to write a code where if a file system has / at the end then replace it with null but it should not affect root file system / for example if ip is /var/opt/home/ then o/p is /var/opt/home but if ip is / then it should remain /. for this i am using below code but no success... (8 Replies)
Discussion started by: Jcpratap
8 Replies

2. Solaris

Bad system call (core dumped) Solaris 11.2 (installation of Sybase 12.5.4)

Dear all, I am trying to install Sybase ASE 12.5.4 on a Sun OS Solaris 11.2 (sparcv9) machine but I am getting the following messages when launching the setup file : -bash-4.1$ ./setup InstallShield Wizard Initializing InstallShield Wizard... Searching for Java(tm) Virtual Machine...... (2 Replies)
Discussion started by: clement_te
2 Replies

3. Shell Programming and Scripting

system call

Trying to figure out a load issue with a webserver. I have traced a php script and noticed the following connect(4, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("XX.XX.XX.XX")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000035> poll(, 1, 2000) = 1 () <0.000120>... (5 Replies)
Discussion started by: rajan007
5 Replies

4. Programming

need help with system call

hi everyone i wrote a system call and compiled the kernel succesfully... my system call is in a file in the kernel folder named my_syscall1.c (kernel/my_syscall1.c) the header file for this system call i added it in the folder include like this include/my_syscall1/my_syscall1.h my problem is... (2 Replies)
Discussion started by: demis87
2 Replies

5. Programming

system call

I have a cgi script which is called after certain time interval, which has this: system ("ls -l /tmp/cgic* | grep -v \"cgicsave.env\" | awk '{print $5}'"); During the execution of this script,the output is 0 sometimes. But due to this the system call is not working at all and doesnt o/p... (2 Replies)
Discussion started by: xs2punit
2 Replies

6. Shell Programming and Scripting

Passing argument to system call in awk script

So, I have this script. It reads a CSV file that has a mixture of object names with IP addresses (parsing out that part I have working), and object names which have a DNS name. I want to be able to run a "dig +short" based off of the name given to me in the line of the awk script, and then deal... (6 Replies)
Discussion started by: mikesimone
6 Replies

7. Programming

C:system call

Hi I'm studing the system call. I've written a small program that return the time spent in doing some operations. Now I'd like to write one that return the time spent in user mode of a process. I'm reading that i should use the tms struct: clock_t times(struct tms *buf); struct tms {... (2 Replies)
Discussion started by: Dedalus
2 Replies

8. Shell Programming and Scripting

system call

Hi, How to write a system calls in a script ? > cd $HOME > ls -ltr thanks in advance.. (10 Replies)
Discussion started by: hegdeshashi
10 Replies

9. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

10. UNIX for Dummies Questions & Answers

a system call for sed in a awk script

Hi, this is my test file : DELETE FROM TABLE WHERE ID_INTERNAL = :TABLE.ID-INTERNAL, ID-INTERNAL-CRAZY ID-INTERNAL-OPEN ID-INTERNAL /ID-INTERNAL/ I want all occurences of ID-INTERNAL replaced with a one, if ID-INTERNAL has and dash afer it , dont replace it example:... (6 Replies)
Discussion started by: seaten
6 Replies
Login or Register to Ask a Question