Bash script to notify when ever any files are changed
Hi the following script let sthe user know whenevr any file is changed inserted or deleted in file system.
but i am getting following error while running bash script
ERROR:
<html>
<body>
'/chkmodifsearch.sh: line 8: syntax error near unexpected token `{
'/chkmodifsearch.sh: line 8: `cretdif() {
</body>
</html>
PHP CODE;
i am trying to call the bash script from php by using the following code.
<html>
<body>
<?php
$i=0;
$output = shell_exec ("./chkmodifsearch.sh");
while ($i < count($output))
{
echo "The Search Data is " . $output[$i] . "<br>";
$i++;
}
?>
Kindly assist me why the unexpected token `{ error is being generated. If sed awk '' and `` thing needs to be done please do it in the bash script
</body>
</html>
Last edited by jim mcnamara; 08-07-2013 at 05:14 PM..
Aside from the fact that this script is a great way to convince people that one-liners are hard to read and maintain, I would guess you did not write it from scratch. Since you do not appear to understand it.
Generally, we are not a code correction service. There are syntax errors in there, but the formatting and structure obfuscates that code to the extent that reading it is difficult.
Maybe some one else can see the problems right away.
What I would do is comment out most of it. Then run it from a command line bit by bit uncommenting and correcting code until it works.
BTW: if you are on Linux consider inotify - it does most of what this script purports to do.
I am trying to check whether particular host and port are responding or not. I am using below script to check. but node_port array that i am using in loop is getting replaced with previous iteration value. Script and output is given.
Please help me to understanding why node_port values are... (5 Replies)
Hi,
The script below works okay and emails me the log in the end once the script completes but what I'm trying to do is to also notify me via an email as soon as the script encounters any error whatsoever.
cat test.list
hdisk0 00a6351a2c832da1 rootvg ... (7 Replies)
Hi All
I am trying to write a shell script that will notify via email if a particular service is down. What I have so far is a script in cron like his:
#!/bin/sh
cd /usr/jdk/instances/jdk1.6.0/bin/sparcv9
jps -m
And the output of the above is
81529 Jps
52988 TaskControllerService... (5 Replies)
Hi All,
I have to work in the late nights some times for server maintenance and in a hurry to complete I am accidentally changing ownership or permission of directories :(
which have similar names ( /var in root and var of some other directory ).:confused:
Can some one suggest me with the... (1 Reply)
This isn't exactly a question. Just thought I'd share something I just wrote and found useful.
For those of you on modern linux boxen: you may be aware that there's a lovely little tool called notify-send that you can use to send notifications to the desktop. Any experienced shell-scripter could... (0 Replies)
Hi,
I am having a little trouble getting notify-send to work the way I would like it to.
I am using ubuntu - karmic koala 2.6.31-19-generic #56-Ubuntu SMP
So here's the problem
run the following commands one after the other.
notify-send -i info -t 100000 -- "Hi" "world" &
notify-send -i... (3 Replies)
I have a server and occasionally the file mysqld.log would show something like
/usr/libexec/mysqld: Disk is full writing './example_com_-_wordpress/wp_statpress.MYD' (Errcode: 122). Waiting for someone to free space... Retry in 60 secs
How do I write a simple shell script to check mysqld.log... (1 Reply)
I am trying to write a script to ftp all files/directories changed in a 24hour period to another AIX server. I have wrote a script to generate a list of all files changed within a 24 hour period but dont know how to then ftp these to another server. How do incorporate ftp into this script?
... (2 Replies)
Can someone please help me with this script, I'm trying to create system backup on AIX, for this I want to first mount the filesystem if it is not mounted, then create the backup and unmount the filesystem but I'm having problem while using the mail command to notify the status of filesystem... (9 Replies)
Hi Experts,
I am trying to write a ksh script that it should notify in case there is no response from the other script. I mean to say that I got a.sh and b.sh
the execution of b.sh depends on a.sh, so if there is no response from a.sh,
b.sh should notify me about the same.
Thanks in Advance (4 Replies)