Sponsored Content
Top Forums Shell Programming and Scripting Process to read a new file entry and execute a command Post 302938038 by kumaran_5555 on Wednesday 11th of March 2015 01:04:54 PM
Old 03-11-2015
Code for @joeyg
Code:
logFile=$1

while [ 1 ]
do
	curr=`wc -l $logFile`
	if [ "$curr" != "$prev" ]
	then
		echo "Command to execute"
	fi
	prev=$curr
	sleep 1

done

If you are looking for real process with realtime signaling instead of polling, you can use inotify() system call with IN_MODIFY.
This User Gave Thanks to kumaran_5555 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

trying to read batch process but need some command help

I am trying to access batch process that take place each nite. I am using Solaris 5.8 (and i am used to redhat). however I am trying to access say a certain directory. The home/oradev , is the directory...in there i am trying to access say a batch file within this, how can see if they are in... (1 Reply)
Discussion started by: etravels
1 Replies

2. Shell Programming and Scripting

File read & execute problem

Hi folks, Need your help. I am writing a KSH script to read a few commands from a file & execute. I am using the following code to read the file line by line & excute each command. When I am printing each line I see it is printing properly but while excuting, the particular "ps" command... (5 Replies)
Discussion started by: tipsy
5 Replies

3. Shell Programming and Scripting

To execute next UNIX command after ending SFTP process.

Hi, I am trying to run a simple UNIX command after i successfully executed SFTP command as shown below. ----------------------------------------- echo 'Step-1' sftp -vvv -b path exit echo 'Step-2' ------------------------------------------ In above script it executes from the 1st... (3 Replies)
Discussion started by: gautamc
3 Replies

4. Shell Programming and Scripting

the shell not pause when execute read command

Hi, i facing a problem when run the script below.. while do if then printf "Please enter a name : " read response # the problem occur here if then ea_ident=${omc_ident} else # # Check that name does not contain invalid... (14 Replies)
Discussion started by: neruppu
14 Replies

5. Shell Programming and Scripting

How to execute commands read from another file?

Please help with this simple example. I can not figure out how to do it. A file named “job” contains only this one line:var=5I need a script to read the job file and execute it as a command. This is my attempt (it does not work):#!/bin/sh exec < job echo "var = $var"output should read “var = 5”... (5 Replies)
Discussion started by: wolfv
5 Replies

6. Shell Programming and Scripting

Read from file and execute the read command

Hi, I am facing issues with the below: I have a lookup file say lookup.lkp.This lookup.lkp file contains strings delimited by comma(,). Now i want to read this command from file and execute it. So my code below is : Contents in the lookup.lkp file is : c_e,m,a,`cd $BOX | ls cef_*|tail... (7 Replies)
Discussion started by: vital_parsley
7 Replies

7. UNIX for Advanced & Expert Users

Using awk to read a file and process

I am fairly green using awk so I don't have anything started but what I am trying to do is: I have a file called "contacts" and in the file are 3 fields separate by ;. I want to read each line and send an email script. I have the email function working but just need to know how to setup awk to... (8 Replies)
Discussion started by: ziggy6
8 Replies

8. Shell Programming and Scripting

Read line by line and execute command

Hi ALL, I have a requirement like this. 1.GET ALL TABLE NAME (just table name) keep in file 2.Read line by line and get the count of table from tablename files. tablename detail has a sql statement "db2 select tabname from syscat.tables" (1 Reply)
Discussion started by: netdbaind
1 Replies

9. Shell Programming and Scripting

Simpler crontab entry to execute pgm on last day of the month

The following bash command line works for the last day of the month. Test by replacing the 1 with tomorrows day of month number && echo "Day before tomorrow"Can it be used within crontab? As * * 28-31 * * && echo "Today ls last day of month" >>/tmp/crontabtestI tried to test crontab with... (1 Reply)
Discussion started by: lsatenstein
1 Replies

10. Shell Programming and Scripting

Other user should not read the file but can execute

Hi, I have one script for which I want that other user should not read the script file but can execute. Is there any method ? I tried by giving 711 but it gives Permission denied to other users. For Generic User id as a work around , I have created alias in .bashrc file and other user... (4 Replies)
Discussion started by: Amit Joshi
4 Replies
nvlist_next_nvpair(3NVPAIR)				 Name-value Pair Library Functions			       nvlist_next_nvpair(3NVPAIR)

NAME
nvlist_next_nvpair, nvpair_name, nvpair_type - return data regarding name-value pairs SYNOPSIS
cc [ flag... ] file... -lnvpair [ library... ] #include <libnvpair.h> nvpair_t *nvlist_next_nvpair(nvlist_t *nvl, nvpair_t *nvpair); char *nvpair_name(nvpair_t *nvpair); data_type_t nvpair_type(nvpair_t *nvpair); PARAMETERS
nvl The nvlist_t to be processed. nvpair Handle to a name-value pair. DESCRIPTION
The nvlist_next_nvpair() function returns a handle to the next nvpair in the list following nvpair. If nvpair is NULL, the first pair is returned. If nvpair is the last pair in the nvlist, NULL is returned. The nvpair_name() function returns a string containing the name of nvpair. The nvpair_type() function retrieves the value of the nvpair in the form of enumerated type data_type_t. This is used to determine the appropriate nvpair_*() function to call for retrieving the value. RETURN VALUES
Upon successful completion, nvpair_name() returns a string containing the name of the name-value pair. Upon successful completion, nvpair_type() returns an enumerated data type data_type_t. Possible values for data_type_t are as follows: o DATA_TYPE_BOOLEAN o DATA_TYPE_BOOLEAN_VALUE o DATA_TYPE_BYTE o DATA_TYPE_INT8 o DATA_TYPE_UINT8 o DATA_TYPE_INT16 o DATA_TYPE_UINT16 o DATA_TYPE_INT32 o DATA_TYPE_UINT32 o DATA_TYPE_INT64 o DATA_TYPE_UINT64 o DATA_TYPE_STRING o DATA_TYPE_NVLIST o DATA_TYPE_BOOLEAN_ARRAY o DATA_TYPE_BYTE_ARRAY o DATA_TYPE_INT8_ARRAY o DATA_TYPE_UINT8_ARRAY o DATA_TYPE_INT16_ARRAY o DATA_TYPE_UINT16_ARRAY o DATA_TYPE_INT32_ARRAY o DATA_TYPE_UINT32_ARRAY o DATA_TYPE_INT64_ARRAY o DATA_TYPE_UINT64_ARRAY o DATA_TYPE_STRING_ARRAY o DATA_TYPE_NVLIST_ARRAY Upon reaching the end of a list, nvlist_next_pair() returns NULL. Otherwise, the function returns a handle to next nvpair in the list. These and other libnvpair(3LIB) functions cannot manipulate nvpairs after they have been removed from or replaced in an nvlist. Replacement can occur during pair additions to nvlists created with NV_UNIQUE_NAME_TYPE and NV_UNIQUE_NAME. See nvlist_alloc(3NVPAIR). ERRORS
No errors are defined. EXAMPLES
Example 1 Example of usage of nvlist_next_nvpair(). /* * usage of nvlist_next_nvpair() */ static int edit_nvl(nvlist_t *nvl) { nvpair_t *curr = nvlist_next_nvpair(nvl, NULL); while (curr != NULL) { int err; nvpair_t *next = nvlist_next_nvpair(nvl, curr); if (!nvl_check(curr)) if ((err = nvlist_remove(nvl, nvpair_name(curr), nvpair_type(curr))) != 0) return (err); curr = next; } return(0); } ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +----------------------------+------------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +----------------------------+------------------------------+ |Interface Stability | Evolving | +----------------------------+------------------------------+ |MT-Level | MT-Safe | +----------------------------+------------------------------+ SEE ALSO
libnvpair(3LIB), nvlist_alloc(3NVPAIR), attributes(5) NOTES
The enumerated nvpair data types might not be an exhaustive list and new data types can be added. An application using the data type enu- meration, data_type_t, should be written to expect or ignore new data types. SunOS 5.11 2 Feb 2004 nvlist_next_nvpair(3NVPAIR)
All times are GMT -4. The time now is 11:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy