Sponsored Content
Top Forums Shell Programming and Scripting TO know whether file is updating or not Post 302143383 by porter on Thursday 1st of November 2007 05:27:06 AM
Old 11-01-2007
Something like

Code:
#!/bin/sh
while true
do
      if test thefile -ot magic
      then
            echo "stale" | mailx -s warning foo@bar
      fi
      touch magic
      sleep 900
done

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sed Help in Updating something only in one particular file.

Hi, The scenerio is that I want to replace a text in one particular line of a file. But when I am using the sed it's replacing all the occurences of that text. Like the file is: >cat test DNGGF10 :None :Test DNGGF11 :ABC :Test1 DNGGF12 :None :Test2 DNGGF13 :None :... (4 Replies)
Discussion started by: bisla.yogender
4 Replies

2. Shell Programming and Scripting

awk updating one file with another, comparing, updating

Hello, I read and search through this wonderful forum and tried different approaches but it seems I lack some knowledge and neurones ^^ Here is what I'm trying to achieve : file1: test filea 3495; test fileb 4578; test filec 7689; test filey 9978; test filez 12300; file2: test filea... (11 Replies)
Discussion started by: mecano
11 Replies

3. UNIX for Advanced & Expert Users

wtmpx file is not updating

Hi in my solaris 9 system wmptx file is not updating so it is not recording any login or logout or any other entry. can any one tell me how to solve this problem (0 Replies)
Discussion started by: aaysa123
0 Replies

4. UNIX for Dummies Questions & Answers

Updating a field in a File without creating temp file's

Hi Experts, I have a requirement where i need to update the below items in file, 1. END TIME 2. PREV_STATUS For the first time the PREV_status and end time of all job the job will be sysdate & NULL reply as below, Session_name,Load Type,Frequency,Seesion End time,Prev_Status... (2 Replies)
Discussion started by: prabhutkl
2 Replies

5. Solaris

Message file is not updating

Hi, Some how message file is not updating on solaris 8, but syslogd is running. Any help. It is urgent. (1 Reply)
Discussion started by: mokkan
1 Replies

6. Shell Programming and Scripting

Reading from one file and updating other file with constant entries

Hi All, Thaks for the help in my last thread. I have one more question. I have two files with ldap entries in it. One file contains all the user LDAP parameter entries (26 MB) and other file contains only the user id's that have to be inactivated. Unix script has to read from the file that has... (8 Replies)
Discussion started by: Samingla
8 Replies

7. Shell Programming and Scripting

updating a file with sed -help

I have a file of records all made up of single charactors that need to be updated using their row/column (the dashes represent spaces as the html formatting of this text box when it posts removes the "nonessential" white space between the charactors) file example A 1 c B 2 b C 3 a... (2 Replies)
Discussion started by: dboward
2 Replies

8. Shell Programming and Scripting

Help updating a file

I can not seem to figure out how to update the attached match.txt column 2 using update.txt. However, only the text before the period in updat.txt appears in match.txt. For example, in update.txt NM_001613.2 matches NM_001613 in match.txt, so is it possible to update the record in match.txt to... (8 Replies)
Discussion started by: cmccabe
8 Replies

9. UNIX for Dummies Questions & Answers

Updating a File

Hi, I have a below requirement and need your help in this regard. I have two timestamps in a file i.e. TimeBefore=2014-07-10.18.06.55 TimeAfter_1=2014-07-09.05.45.12 TimeAfter_2=2014-07-09.05.40.12 When I first run the script file, it sets the 'TimeBefore' to todays date. When I run... (5 Replies)
Discussion started by: vrupatel
5 Replies

10. UNIX for Beginners Questions & Answers

Updating in file

hi, i have an csv(which is a month's log file containing userid and log in date ) file which has to be appended to another file say master.log.I need to compare the next month's log data to master.log file .In case, there is new log date for userid it has to get updated in master.log file or i... (2 Replies)
Discussion started by: preema
2 Replies
VNSTATD(1)							   User Manuals 							VNSTATD(1)

NAME
vnStatd - the alternative for cron based updating SYNOPSIS
vnstatd [ -Ddnpsv? ] [ --config file ] [ --daemon ] [ --debug ] [ --help ] [ --noadd ] [ --nodaemon ] [ --pidfile file ] [ --sync ] [ --version ] DESCRIPTION
The purpose of vnstatd is to provide a more flexible way for updating vnstat(1) databases than what using cron for updating can provide. The daemon makes possible updating databases more often but at the same time requires less disk access since data can be cached and written only later to disk at a user configurable interval. It is also able to track how interfaces come and go without the need of additional scripts that are required with cron based updates. vnstatd is the command for starting the daemon. The daemon can either fork itself to run as a background process or stay attached to the terminal. It supports logging to a user selectable file or using syslog. Once started, the daemon will check if there are any databases available in the database directory that has been specified in the configu- ration file. New databases will be created for all available interfaces excluding pseudo interfaces lo, lo0 and sit0 if no databases are found during startup. OPTIONS
--config file Use file as config file instead of using normal config file search function. -d, --daemon Fork process to background and run as a daemon. -D, --debug Provide additional output for debug purposes. The process will stay attached to the terminal for output. --noadd Disable automatic creation of new databases for all available interfaces if the daemon is started with zero database found. Pseudo interfaces lo, lo0 and sit0 are excluded from getting added. -n, --nodaemon Stay in foreground attached to the current terminal and start update process. -p, --pidfile file Write the process id to file and use it for locking so that another instance of the daemon cannot be started if the same file is specified. -s, --sync Synchronize internal counters in the database with interface counters for all available interfaces before starting traffic monitor- ing. Use this option if the traffic between the previous shutdown and the current startup of the daemon needs to be ignored. This option isn't required in normal use because the daemon will automatically synchronize the internal counters after a system reboot, if enought time has passed since the daemon was previously running or if the internal counters are clearly out of sync. -v, --version Show current version. -?, --help Show a command summary. CONFIGURATION
The behaviour of the daemon is configured mainly using the configuration keywords UpdateInterval, PollInterval and SaveInterval in the con- figuration file. UpdateInterval defines in seconds how often the interface data is updated. This is similar to the run interval for alternative cron based updating. However, the difference is that the data doesn't get written to disk during updates. PollInterval defines in seconds how often the list of available interfaces is checked for possible changes. The minimum value is 2 seconds and the maximum 60 seconds. PollInterval also defines the resolution for other intervals. SaveInterval defines in minutes how often cached interface data is written to disk. A write can only occur during the updating of inter- face data. Therefore, the value should be a multiple of UpdateInterval with a maximum value of 60 minutes. The default values of UpdateInterval 20, SaveInterval 5 and PollInterval 2 are usually suitable for most systems and provide a similar be- haviour as cron based updating does but with a better resolution for interface changes and fast interfaces. For embedded and/or low power systems more tuned configurations are possible. In such cases if the interfaces are mostly static the PollInterval can be rised to around 10-30 seconds and UpdateInterval set to 60 seconds. Higher values up to 300 seconds are possible if the interface speed is 10 Mbit or less. SaveInterval can be rised for example to 15, 30 or even 60 minutes depending on how often the data needs to be viewed. SIGNALS
The daemon is listening to signals SIGHUP, SIGINT and SIGTERM. Sending the SIGHUP signal to the daemon will cause cached data to be writ- ten to disk, a rescan of the database directory and a reload of settings from the configuration file. However, the pid file will not be updated even if it's configuration setting has been changed. SIGTERM and SIGINT signals will cause the daemon to write all cached data to disk and then exit. FILES
/var/lib/vnstat/ Default database directory. Files are named according to the monitored interfaces. /etc/vnstat.conf Config file that will be used unless $HOME/.vnstatrc exists. See the configuration chapter and vnstat.conf(5) for more information. /var/log/vnstat.log Log file that will be used if logging to file is enable and no other file is specified in the config file. /var/run/vnstat.pid File used for storing the process id if no other file is specified in the configuration file or using the command line parameter. RESTRICTIONS
Updates needs to be executed at least as often as it is possible for the interface to generate enough traffic to wrap the kernel interface traffic counter. Otherwise it is possible that some traffic won't be seen. This isn't an issue for 64 bit kernels but at least one update every hour is always required in order to provide proper input. With 32 bit kernels the maximum time between two updates depends on how fast the interface can transfer 4 GiB. Calculated theoretical times are: 10 Mbit: 54 minutes 100 Mbit: 5 minutes 1000 Mbit: 30 seconds However, for 1000 Mbit interfaces updating once every minute is usually a working solution. Virtual and aliased interfaces cannot be monitored because the kernel doesn't provide traffic information for that type of interfaces. Such interfaces are usually named eth0:0, eth0:1, eth0:2 etc. where eth0 is the actual interface being aliased. AUTHOR
Teemu Toivola <tst at iki dot fi> SEE ALSO
vnstat(1), vnstati(1), vnstat.conf(5), signal(7) version 1.11 JUNE 2011 VNSTATD(1)
All times are GMT -4. The time now is 06:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy