Run it from /etc/inittab instead of crontab, or write a script thatQuote:> I've got a PBX connected to my /dev/ttyS0 at 9600. With minicom
> I can see the calls that where made. I wanna use a script for
> getting all that data..
> i've tryed from crontab
> */5 * * * cat /dev/ttyS0 > /var/log/PBX.log
> it worked, but it seems that as the cat cant find a EOF from the
> filehandle
> it never returns 0 and never dies (so after one hour i found like 5
> thousands crond. child's)..
> any idea? any help?
> Thanks, Esteban.
#!/bin/sh
trap 'rm /var/run/pbxlog.pid' 0
echo $$ > /var/run/pbxlog.pid
cat /dev/ttyS0 > /var/log/PBX.log
> I've got a PBX connected to my /dev/ttyS0 at 9600. With minicom
> I can see the calls that where made. I wanna use a script for
> getting all that data..
> i've tryed from crontab
> */5 * * * cat /dev/ttyS0 > /var/log/PBX.log
> it worked, but it seems that as the cat cant find a EOF from the
> filehandle
> it never returns 0 and never dies (so after one hour i found like 5
> thousands crond. child's)..
> any idea? any help?
> Thanks, Esteban.
; RECORD.TAK - Records Call Detail Records from the SMDR box
; Requires MS-Kermit version 3.12 or later
DEFINE RECORD TAKE C:\KERMIT\RECORD.TAK
SET PORT 1 ; Set for COM1
SET SPEED 4800 ; Set speed to 4,800 bps
SET PARITY NONE
SET FLOW-CONTROL RTS/CTS
; Switch to desired directory
CWD C:\TELCO
; Display the received characters on the screen
SET INPUT ECHO ON
; We use a loop here so as to open and close the session log
; once a minute. This ensures that data is written to disk and
; not held in a buffer and minimizes the amount of data lost in
; the event of a power failure.
;
; The filename in which data is recorded is of the form:
; YYYYMMDD.cdr
; where YYYY - the year
; MM - the month
; DD - the day
; To do this requires the use of MS-Kermit 3.12 or later because
; it is done using the \v(ndate) variable.
;
; Because the filename is the numeric date and the file is
; opened and closed every minute, Kermit will start recording in
; a new file every day. Be sure the clock on the PC is set to
; the correct time-of-day!
:WAIT_LOOP
; Close the session log file. This causes Kermit to write any
; data in its buffers to disk first.
CLOSE SESSION
; Re-open the session log file.
LOG SESSION \v(ndate).CDR
; Wait 60 seconds
SET ALARM 60
PAUSE 60
; If the script gets here before the 60 second timer expired
; then someone pressed a key. Go to label NO_ALARM.
IF NOT ALARM GOTO NO_ALARM
INPUT 1 \255
IF FAILURE GOTO WAIT_LOOP
GOTO WAIT_LOOP
; Someone pressed a key. Close the file and clear the screen.
:NO_ALARM
CLOSE SESSION
RUN CLS
; I recommend good physical security for the PC running this
; script to prevent idle people from poking it to see what it is
; doing. Even a lockable keyboard makes a big difference.
; I don't have physical security so I inserted the following
; code to try and prevent repeat occurances.
;
; After 120 times around the RPT_MSG loop (120 x 5 = 10 minutes)
; we will go back to the WAIT_LOOP if no further key presses
; occur.
SET COUNT 120
:RPT_MSG
; Sound audible alarm and display a fake trouble report
; to discourage unauthorized key-pressing in the future.
RUN WARBLE
ECHO ERROR: PBX error. PBX may not process any further calls.
ECHO Call Mitel Repair service.
ECHO .
; Repeat every five seconds.
SET ALARM 5
PAUSE 5
IF NOT ALARM GOTO REAL_QUIT
IF COUNT GOTO RPT_MSG
GOTO WAIT_LOOP
; Someone pressed a key while we were in the RPT_MSG loop.
; Display another fake trouble report and then quit.
:REAL_QUIT
ECHO PBX FATAL ERROR!
ECHO All calls in progress disconnected.
STOP
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 80,000 Newsgroups - 16 Different Servers! =-----
What you are dealing with is a virtual file, asQuote:> I've got a PBX connected to my /dev/ttyS0 at 9600. With minicom
> I can see the calls that where made. I wanna use a script for
> getting all that data..
> i've tryed from crontab
> */5 * * * cat /dev/ttyS0 > /var/log/PBX.log
> it worked, but it seems that as the cat cant find a EOF from the
> filehandle
> it never returns 0 and never dies (so after one hour i found like 5
> thousands crond. child's)..
> any idea? any help?
> Thanks, Esteban.
HTH
Bruce<+>
You might try
a) switching to raw mode prior to the 'cat' command, or
b) switching the /dev/ttyS0 'stty eof' character to the appropriate
character for your serial feed.
You might also think of using 'dd' or 'tail' instead of 'cat'Quote:> it never returns 0 and never dies (so after one hour i found like 5
> thousands crond. child's)..
> any idea? any help?
--
Lew Pitcher
Master Codewright and JOAT-in-training
Registered (Slackware) Linux User #112576 (http://counter.li.org/)
begin 112576
I have been rather confused after reading the documentation and the FAQ
(March 1993) for Linux. Some places the first serial port is referred to as
/dev/ttys0 and some places it is referred to as /dev/ttyS0. Are these just
typos and if so which one is correct???. In my /dev directory I have ttys0,
ttys1 etc. Did the device names change between releases?? I have the .99p4
release ( I know the current release is patchlevel 8, but I cannot afford the
time to reinstall Linux every three weeks when a new patchlevel is introduced!
2. KDE Control in QT Designer - How?
3. Solaris 8 box: cat file | rsh solaris_2.6_box "cat > /dev/null" SLOW
6. Q: How to dial to an ISP on demand ?
7. Unable to bind to /dev/cua0 or /dev/ttyS0
9. Difference between /dev/ttyS0 and /dev/cua0
10. cat file > /dev/cua1 vs. cp file /dev/cual ?
11. cp /dev/null or cat /dev/null
12. cat /dev/mouse > /dev/audio... Newbie Help
13. cat /dev/null > /dev/rmt0 dangerous?