03-02-2011
It sounds valid. If a check with an interval of not less than every minute is okay for you, you could just trigger that script by cron. If you write a little shell script demon, don't forget to put at least a sleep 1 in it so that it does not bring your box to 100% CPU usage.
Instead of checking mtime you could also use cksum to see if something has been changed.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I have some log files created in the following fashion
Ex:
file name modified date
1) s.log1 01-jan-08
2) s.log2 02-jan-08
3) s.log3 03-jan-08
4) s.log4 04-jan-08
Now I want to have the latest 2 logs and delete the others.
Can you tell me the one liner /... (1 Reply)
Discussion started by: ammu
1 Replies
2. Shell Programming and Scripting
Hi All,
I want to extract last modified, seen in ls -l command, of a file and then convert it into "YYYYMMDD" format.
Any help regarding would be helpful
Thanks in advance... (3 Replies)
Discussion started by: itsme_maverick
3 Replies
3. Shell Programming and Scripting
How to change the modified time of a file to any specified time.
ls -ltr
drwxr-xr-x 2 pipe pipe 4096 Jun 10 10:33 coredump_06062008
----------------------------------------------------------------------
here file coredump_06062008 last modified time is Jun 10 10:33 and i... (1 Reply)
Discussion started by: ali560045
1 Replies
4. Shell Programming and Scripting
I have a file called MasterRECEIVEFranScript. I need to change its modified time to Sep 20 09:34 2008
For this i have tried a command ,but no success
touch -m -t 1222079885 MasterRECEIVEFranScript
-------------------------------------------------------------
Plz help me in this ?
... (6 Replies)
Discussion started by: ali560045
6 Replies
5. Shell Programming and Scripting
Hi all,
I am struggling to change the content of a file without changing the inode number. The exact issue is as below.
I have a file name test.bak which has 100 lines of text.
I am trying to to delete the first 90 lines of the text in the file.
I know that using sed/awk/head/tail I can... (3 Replies)
Discussion started by: sathishkmrv
3 Replies
6. Shell Programming and Scripting
Hi,
I have modified one file today. So if i give `ls -lrt filename` command it will show the current modified time.
But i wanted to know what is the previous modified time for this file
Is there any way to find this
Thanks,
Puni (3 Replies)
Discussion started by: puni
3 Replies
7. Shell Programming and Scripting
Hi.,
Last modified time of the folder is changing when I view the file inside the directory. Here is the test on sample directory. I believe that ls -l commands gives the time detail w.r.t last modified time. Pl. suggest.
bash-3.2$ mkdir test
bash-3.2$ cd test
bash-3.2$ touch myfile.txt... (2 Replies)
Discussion started by: IND123
2 Replies
8. UNIX for Advanced & Expert Users
Hi,
I am new bie to Unix. Might be a simple question I am asking.
I want to find the last modified time of a file and find the difference between the currrent time and the last modified time. Appreciate, if someone can throw some light on what commands can be used.
Cheers,
James (2 Replies)
Discussion started by: JamesJoe
2 Replies
9. Shell Programming and Scripting
Hi,
I need to run a script file which uses a file and that file is modified as and when some alarms generated, it is not based on any fixed time period.. it may be modified even once in a minute for some time and once in 30 min or once in 20 min. Hence i need to watch for the timestamp change of... (3 Replies)
Discussion started by: aemunathan
3 Replies
10. Shell Programming and Scripting
A files last modified time is like 03/02/2012 xx:xx:xx
So what would be the command to convert the last modified in the given signature
Thanks for giving time and replying..:) (2 Replies)
Discussion started by: ezee
2 Replies
LEARN ABOUT NETBSD
script
SCRIPT(1) BSD General Commands Manual SCRIPT(1)
NAME
script -- make typescript of terminal session
SYNOPSIS
script [-adfpqr] [-c command] [file]
DESCRIPTION
script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive
session as proof of an assignment, as the typescript file can be printed out later with lpr(1).
If the argument file is given, script saves all dialogue in file. If no file name is given, the typescript is saved in the file typescript.
Option:
-a Append the output to file or typescript, retaining the prior contents.
-c command
Run the named command instead of the shell. Useful for capturing the output of a program that behaves differently when associated
with a tty.
-d When playing back a session with the -p flag, don't sleep between records when playing back a timestamped session.
-f Flush output after each write. This is useful for watching the script output in real time.
-p Play back a session recorded with the -r flag in real time.
-q Be quiet, and don't output started and ended lines.
-r Record a session with input, output, and timestamping.
The script ends when the forked shell exits (a control-D to exit the Bourne shell (sh(1)), and exit, logout or control-d (if ignoreeof is not
set) for the C-shell, csh(1)).
Certain interactive commands, such as vi(1), create garbage in the typescript file. script works best with commands that do not manipulate
the screen, the results are meant to emulate a hardcopy terminal.
ENVIRONMENT
The following environment variable is used by script:
SHELL If the variable SHELL exists, the shell forked by script will be that shell. If SHELL is not set, the Bourne shell is assumed. (Most
shells set this variable automatically).
SEE ALSO
csh(1) (for the history mechanism).
HISTORY
The script command appeared in 3.0BSD.
BUGS
script places everything in the log file, including linefeeds and backspaces. This is not what the naive user expects.
BSD
October 17, 2009 BSD