Sponsored Content
Top Forums Shell Programming and Scripting Weird Error (: No such file or directory) Post 302937368 by jeetz on Thursday 5th of March 2015 09:06:08 AM
Old 03-05-2015
Weird Error (: No such file or directory)

Hi Everyone,

I am trying to make this script to use, to find out the DAHDI channel status. Every thing works fine, I even get proper results, however I have this weird error that comes along.
Can someone please help me. Thanks a lot.
Code:
#!/bin/bash

# Color to set the test to when a channel is down (red or green)
# ---------------------------------------------------------------
TESTCOL="red"
COLOR="green"
data=`cat /proc/dahdi/1`
chandata=`echo "${data}" | sed -e 's/\t//' -e 's/ \+//' | grep ^[1-4]`
card=`echo "${data}" | grep ^Span`


# -----------------------------------------------
IFS=$'\n'
for channel in ${chandata}; do
    curcolor="green"
    chinfo=`echo ${channel} | cut -d' ' -f1-3`
    status=`echo ${channel} | grep -i "red" 2>&1`
    if [ ! -z ${status} ]; then
        curcolor=${TESTCOL}
        COLOR=${TESTCOL}
    fi
    MSG="${MSG}
   Channel:${chinfo} ${curcolor}
"
done
unset IFS

# -----------------------------------------------
# Prepend the administrative message to the report
# add the card information, the channel statuses
"${COLOR} ${card} ${MSG}"

Result is as following....
Code:
[root@PBX~]# ./dahdi.sh
./dahdi.sh: line 31: red Span 1: WCTDM/0 "Wildcard A4B" (MASTER)
   Channel:1 WCTDM/0/0 FXSKS green

   Channel:2 WCTDM/0/1 FXSKS green

   Channel:3 WCTDM/0/2 FXSKS red

   Channel:4 WCTDM/0/3 FXOKS green
: No such file or directory

 

10 More Discussions You Might Find Interesting

1. Web Development

weird 500 Internal server error

Hi All, I am seeking some help. While trying to access my website: EDITED (hosted on private server somewhere - don't want to publicize names) - I have a weird behaviour: I can always get to the site - but some applications get a 500 Internal error. If I use FireBug (mozilla addon) I can... (2 Replies)
Discussion started by: saariko
2 Replies

2. Programming

C - advice how to catch some weird error

I have some unstable mistake in my program and out-of-idea how to catch it. I am looking for advice with a way to work it out! I have in a pretty complicated program (but one source file) set of int-counters - 15, if exactly. Lately, on final printout I have inpossible value (I am... (3 Replies)
Discussion started by: alex_5161
3 Replies

3. Shell Programming and Scripting

Weird unbalanced quotes error

hi all, i am writing a wrapping script to burn subtitle into video file using transcode. I got this very weird error: code: inFile="movie.avi" subFile="sub.srt" outFile="movie_sub.avi" strExc="-i $inFile -x 'mplayer=-sub $subFile' -w $vidBR -o $outFile -y xvid" echo "transcode $strExc"... (2 Replies)
Discussion started by: tduccuong
2 Replies

4. Shell Programming and Scripting

share a shell script which can replace weird characters in directory or file name

I just finish the shell script . This shell can replace weird characters (such as #$%^@!'"...) in file or directory name by "_" I spent long time on replacing apostrophe in file/directory name added: 2012-03-14 the 124th line (/usr/bin/perl -i -e "s#\'#\\'#g" /tmp/rpdir_level$i.tmp) is... (5 Replies)
Discussion started by: begonia
5 Replies

5. Ubuntu

Need help with a weird sudo error.

I'm fairly new to unix and I was trying to change the name of my host and my user. I changed the name in /hostname using this: gksudo gedit /etc/hostname I then tried changing the name back but it still gave the same error: {env_reset,... (1 Reply)
Discussion started by: H3jck
1 Replies

6. UNIX for Dummies Questions & Answers

Weird Error moving a file

Hi, We are running into very weird error on AIX. Target directory exists on NFS. We have one script runs every 5 mins on our system. This script is running for 5 years for now without any issuess. Followig is the snapshot of the script : stmt_cnt=$(ls -1 ${1}/${2}|wc -l) if ;... (7 Replies)
Discussion started by: himihir2000
7 Replies

7. Solaris

/bin/find: stat() error <File> : No such file or directory

Hi, I am getting below error in Solaris 10 SPARC when trying to issue a search on /var/tmp partition Below is the query /bin/find /var/tmp/ -type f -atime +1 Below is the result /bin/find: stat() error <File> : No such file or directory (28 Replies)
Discussion started by: prash358
28 Replies

8. Shell Programming and Scripting

Weird Perl error using db2.

I have having a heck of a time figuring this out so any help is much appreciated. Here is the code where it seems to be dying, I bolded the part it is complaining about: $sth = $dbh->prepare( $query ) or die "error with query\n"; $sth->execute() or die "error executing query ...\n"; while(... (1 Reply)
Discussion started by: savigabi
1 Replies

9. Shell Programming and Scripting

awk weird error

Here is the awk code i wrote : if ; then gawk -v field_position="$field_position" -v field_length="$field_length" -v header="$header" -v trailer="$trailer" -v lr="$lr" '{ if(NR==1&&header=="1") { next } if(NR==lr&&trailer=="1") { next }... (1 Reply)
Discussion started by: ysvsr1
1 Replies

10. UNIX for Beginners Questions & Answers

Weird error after excutiong, completed fine though

Hi Guys - I'm getting the following error when I run my script: which: no Data_Export.sh in (.) However, my code completes with fine with a return code of 0. The above error message gets directed to my error file. Any ideas? Here is my script: #source... (1 Reply)
Discussion started by: SIMMS7400
1 Replies
DAHDI_CFG(8)															      DAHDI_CFG(8)

NAME
dahdi_cfg - configures DAHDI kernel modules from /etc/dahdi/system.conf SYNOPSIS
dahdi_cfg [-c CFG_FILE] [-s] [-f] [-t] [-v [-v ... ] ] dahdi_cfg -h DESCRIPTION
dahdi_cfg configures DAHDI interface cards from a config file. You generally need to run it with a valid configurations in order for DAHDI modules to work properly. It must be run to configure every DAHDI span. Normally it is run from the DAHDI init script. OPTIONS
-c CFG_FILE Use an alternative configuration file instead of /etc/dahdi/system.conf -s Only shutdown spans. -f Always configure every channel, even if it appears not to have changed. -t Test mode. Don't do anything, just report what you wanted to do. -v Be more verbose. Add extra v-s for extra verbosity. -h Display a brief help message. FILES
/etc/dahdi/system.conf The default location for the configuration file. SEE ALSO
dahdi_tool(8), dahdi_monitor(8), asterisk(8). AUTHOR
This manual page was written by Santiago Ruano Rincon <santiago@unicauca.edu.co> for the Debian system (but may be used by others). Per- mission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. 16 Jun 2008 DAHDI_CFG(8)
All times are GMT -4. The time now is 06:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy