04-10-2008
Watch the brackets. It's not "( )", but "[ ]"
It's not elsif. It should be elif or else if
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Situation: I have a working shell script on our file server (OSXS Tiger) to connect to a workstation, which is using a portable home directory (phd), and rsync a user's MirrorAgent.log. I'm not that strong of a scripter (obviously), but I would like to add other workstations to this script as they... (4 Replies)
Discussion started by: le0pard13
4 Replies
2. Shell Programming and Scripting
Hi guys
I tried to convert this c++ code to c shell script but there are some bugs and I don't know how to solve it.
This code prints the three variables in decreasing order:
int main()
{
int x,y,z;
cin >> x >> y >>z;
if ( x < y )
if ( x < z )
if ( y < z )
cout << x <<" " <<... (2 Replies)
Discussion started by: domain
2 Replies
3. Shell Programming and Scripting
perl script:
my $logdir = '/smp/dyn/logfiles/fsm/mp/mp';
$logdir = $logdir ."/mp${toDate}*";
i tried to make it..as below .. but not working ..
date +%m%d%y
logdir = /smp/dyn/logfiles/fsm/mp/mp
logdir=$logdir/mp"$date"
but it was not working.....
can someone please help me out in... (1 Reply)
Discussion started by: mail2sant
1 Replies
4. Shell Programming and Scripting
hi experts,
how will i convert the first part of my script into expect or tcl since shell script cannot be embedded into expect script ? i have 100+ servers in my serverlist. how will i call or declare it in expect or tcl ?
#!/usr/sbin/expect -f
serverlist=`cat $1`
for i in serverlist... (2 Replies)
Discussion started by: linuxgeek
2 Replies
5. Shell Programming and Scripting
I have a shell script which I made with the help of this forum
#!/bin/sh
RuleNum=$1
cat bw_rules | sed 's/^.*-x //' | awk -v var=$RuleNum '$1==var {for(i=1;i<=NF;i++) {if($i=="-bwout") print $(i+3),$(i+1)}}'
Basically I have a pages after pages of bandwidth rules and the script gives... (0 Replies)
Discussion started by: sb245
0 Replies
6. Red Hat
Dear!
I've a script (vbscript) running on windows machine for along time ago. 2 weeks ago, we changed server from Windows to RHEL5, and this script did not run, and I'm not programmer. So that, I post this script here and wish you convert for me.
vbscript code:
'This script will:
' - ZIP... (1 Reply)
Discussion started by: trantuananh24hg
1 Replies
7. Shell Programming and Scripting
Hi is there a way that i can convert this simple perl program into shell script
#!usr/bin/perl -w
use strict;
use warnings;
open INPUTFILE, "uniqprobecoordinates.out" || die "canot open the file $!";
open OUTPUTFILE, ">", "1_4reads.out";
while(<INPUTFILE>)
{
chomp;
... (3 Replies)
Discussion started by: bhargavpbk88
3 Replies
8. Shell Programming and Scripting
how to convert these code to shell script
#include<stdio.h>
#include<conio.h>
main()
{
int
i,j,a=0,b=0,c=0,f,t,al,ta;
int a1, max, n, n1,p,k=0;
printf(“\n enter no.of resources”);
scanf(“%d”,n1);
printf(“\nenter the max no .of resources for each type”);
for(i=0;i<n1;i++)... (4 Replies)
Discussion started by: syah
4 Replies
9. Shell Programming and Scripting
Hello,,I have a very small script that contains these lines; and it works perfectly; however I need to use Perl now as I will need to feel variables from a MySQL table into this; to it would be nice to start by converting this first...
find / -perm 777 \( -type f -o -type d \) -exec ls -lid {}... (1 Reply)
Discussion started by: gvolpini
1 Replies
10. Shell Programming and Scripting
I had try to create a basic shell script. So now im trying to convert in to C-programming language can some one guide/help me out with it?(BTW IM USING A LINUX/UNIX/ORACLE SYSTEM) CODE BELOW
!/bin/bash
for i in `ls -1 /cslab/home/JAZEL/`
do
cp -uv $i /cslab/home/JAZEL/cs295/$i.`date... (2 Replies)
Discussion started by: Nygenesis
2 Replies
LEARN ABOUT SUSE
log::log4perl::config::watch
Config::Watch(3) User Contributed Perl Documentation Config::Watch(3)
NAME
Log::Log4perl::Config::Watch - Detect file changes
SYNOPSIS
use Log::Log4perl::Config::Watch;
my $watcher = Log::Log4perl::Config::Watch->new(
file => "/data/my.conf",
check_interval => 30,
);
while(1) {
if($watcher->change_detected()) {
print "Change detected!
";
}
sleep(1);
}
DESCRIPTION
This module helps detecting changes in files. Although it comes with the "Log::Log4perl" distribution, it can be used independently.
The constructor defines the file to be watched and the check interval in seconds. Subsequent calls to "change_detected()" will
o return a false value immediately without doing physical file checks if "check_interval" hasn't elapsed.
o perform a physical test on the specified file if the number of seconds specified in "check_interval" have elapsed since the last
physical check. If the file's modification date has changed since the last physical check, it will return a true value, otherwise a
false value is returned.
Bottom line: "check_interval" allows you to call the function "change_detected()" as often as you like, without paying the performing a
significant performance penalty because file system operations are being performed (however, you pay the price of not knowing about file
changes until "check_interval" seconds have elapsed).
The module clearly distinguishes system time from file system time. If your (e.g. NFS mounted) file system is off by a constant amount of
time compared to the executing computer's clock, it'll just work fine.
To disable the resource-saving delay feature, just set "check_interval" to 0 and "change_detected()" will run a physical file test on every
call.
If you already have the current time available, you can pass it on to "change_detected()" as an optional parameter, like in
change_detected($time)
which then won't trigger a call to "time()", but use the value provided.
SIGNAL MODE
Instead of polling time and file changes, "new()" can be instructed to set up a signal handler. If you call the constructor like
my $watcher = Log::Log4perl::Config::Watch->new(
file => "/data/my.conf",
signal => 'HUP'
);
then a signal handler will be installed, setting the object's variable "$self->{signal_caught}" to a true value when the signal arrives.
Comes with all the problems that signal handlers go along with.
TRIGGER CHECKS
To trigger a physical file check on the next call to "change_detected()" regardless if "check_interval" has expired or not, call
$watcher->force_next_check();
on the watcher object.
DETECT MOVED FILES
The watcher can also be used to detect files that have moved. It will not only detect if a watched file has disappeared, but also if it has
been replaced by a new file in the meantime.
my $watcher = Log::Log4perl::Config::Watch->new(
file => "/data/my.conf",
check_interval => 30,
);
while(1) {
if($watcher->file_has_moved()) {
print "File has moved!
";
}
sleep(1);
}
The parameters "check_interval" and "signal" limit the number of physical file system checks, simililarily as with "change_detected()".
COPYRIGHT AND LICENSE
Copyright 2002-2009 by Mike Schilli <m@perlmeister.com> and Kevin Goess <cpan@goess.org>.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.12.1 2010-02-07 Config::Watch(3)