Need Help Writing Script To Email When Fax Queue Goes Down


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need Help Writing Script To Email When Fax Queue Goes Down
# 1  
Old 06-01-2009
Need Help Writing Script To Email When Fax Queue Goes Down

I need a script that would email me when the fax queue goes down. How would I go about doing this? Our fax queue drops a few times a week and if I don't catch it fairly quickly it gets backed up really fast which makes the users a little unhappy...

I am new to Unix-AIX.

We are running Unix-AIX 6 running Activant Eclipse ERP
We also have an Exchange Email Server which is used to email orders from the Eclipse System on UNIX.

I would appreciate any help on this!!
# 2  
Old 06-01-2009
Presumably when the FAX queue has "gone down" it no longer send faxes?
How do you tell from within Unix that the FAX queue has "gone down"?
What do you then do to fix the fax queue because that could be automated also?
# 3  
Old 06-02-2009
Quote:
Originally Posted by TonyFullerMalv
Presumably when the FAX queue has "gone down" it no longer send faxes?
How do you tell from within Unix that the FAX queue has "gone down"?
What do you then do to fix the fax queue because that could be automated also?
Correct, faxes cease to be sent out when the queue goes down.
The state of the device "modem1" goes to "not running" I run vfxstat -a to see the status of the modems.
I run a command that was created before I started here called "fixfax" which restarts the vsi-fax service.

Could I do some sort of IF > THEN statement? I don't have much script writing experience at all.

Last edited by ITAdmin08; 06-02-2009 at 09:27 AM..
# 4  
Old 06-02-2009
Okat here goes:
Code:
#!/bin/sh
PATH=/usr/bin:/path/to/fax/commands
export PATH

FAXSTATUS=`vxfstat -a`
FAXTEST=`echo "${FAXSTATUS}" | grep "not running"`
if [ -n "${FAXTEST}" ]; then
  date > /tmp/mailfile
  echo "Fax not running." >> /tmp/mailfile
  echo "Status =" >> /tmp/mailfile
  echo ${FAXSTATUS} >> /tmp/mailfile
  fixfax
  sleep 3
  echo "Status after running fixfax =" >> /tmp/mailfile
  vxfstat -a >> /tmp/mailfile
  mailx -s "Fax has gone down" user@domain.com < /tmp/mailfile
fi

Replace /path/to/fax/commands with the path to vxfstat and fixfax.
Replace the email address with the one (or more with comma delimiters) that the message should go to.

Call this from cron at suitable regular intervals as the user that can get the status and run fixfax and it may be self healing as well as emailing that the fax queue went down.
# 5  
Old 06-03-2009
Quote:
Originally Posted by TonyFullerMalv
Okat here goes:
Code:
#!/bin/sh
PATH=/usr/bin:/path/to/fax/commands
export PATH

FAXSTATUS=`vxfstat -a`
FAXTEST=`echo "${FAXSTATUS}" | grep "not running"`
if [ -n "${FAXTEST}" ]; then
  date > /tmp/mailfile
  echo "Fax not running." >> /tmp/mailfile
  echo "Status =" >> /tmp/mailfile
  echo ${FAXSTATUS} >> /tmp/mailfile
  fixfax
  sleep 3
  echo "Status after running fixfax =" >> /tmp/mailfile
  vxfstat -a >> /tmp/mailfile
  mailx -s "Fax has gone down" user@domain.com < /tmp/mailfile
fi

Replace /path/to/fax/commands with the path to vxfstat and fixfax.
Replace the email address with the one (or more with comma delimiters) that the message should go to.

Call this from cron at suitable regular intervals as the user that can get the status and run fixfax and it may be self healing as well as emailing that the fax queue went down.

looks like this will work. only problem is when fixfax is run it requires you to hit the enter key, is there a way to do that? Could I just leave out fixfax? I really just need it to notify me.
# 6  
Old 06-03-2009
It will be a case of trying a few things, e.g.:
Code:
echo "" | fixfax

or

Code:
fixfax <<EEOOFF

EEOFF

Note the intentional blank line, which is the carriage return/enter character.

or:
Put the following into a file called fixfax.exp and call it from the original script instead of calling fixfax directly:
Code:
#!/usr/bin/expect
spawn /path/to/fixfax
expect "please press enter:"
send "\r"
expect eof

Confirm where expect is installed on your system and change the header accordingly.
Confirm what text fixfax spits out before wanting the enter key hit and the change the
expect "please press enter:" line accordinlgy.

Last edited by TonyFullerMalv; 06-03-2009 at 05:08 PM.. Reason: Formatting
# 7  
Old 06-03-2009
I'll try these out.
Thanks for your help! I was able to use this script for my print queues as well.

Again, I greatly appreciate this!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Sendmail FAX configuration

I've been trying to send FAXs from an HP_UX server using sendmail via an Esker FAX server. However if I try to include FAX configuration details in the receipient address it fails. See following string for general format... (1 Reply)
Discussion started by: JohnMair
1 Replies

2. Shell Programming and Scripting

Detect if script starts from queue

Dear community, what I'm try to do is deny users to run a script without parameters from command bash, but the same script should run without parameters only from crontab. Example runs by crontab:*/5 * * * * /tmp/script.sh Here the normal execution starts every 5 minutes Example #1 runs by... (16 Replies)
Discussion started by: Lord Spectre
16 Replies

3. UNIX for Dummies Questions & Answers

can we send fax to remote fax machine by lpr?

Hi all, Our application has to send Fax to our cutomer Fax number . I am using lpr -P faxser:test-fax <<dos format file>> I tested on our network Fax numbers . Its working fine. But when i try to send outside our network , its not sending all files are sitting in... (1 Reply)
Discussion started by: help_need
1 Replies

4. UNIX for Advanced & Expert Users

Fax problem

Using the sendmail or other commands i need to send the attachment files for the Fax? Please provide the some example. (3 Replies)
Discussion started by: kingganesh04
3 Replies

5. AIX

fax

aix5.3 - how do i test moden that just install/configure in aix5.3, and also how do i send fax ? (0 Replies)
Discussion started by: tjmannonline
0 Replies

6. Shell Programming and Scripting

File queue script

Dear Gurus, I have an application that sends me thousands of small files. I need to write a script that sleeps for some time untile enough files have arrived then concatenate (n) files into 1 big file, then send that big file to a program to process it. For example, if I have the following... (2 Replies)
Discussion started by: GMMike
2 Replies

7. Shell Programming and Scripting

Fax Component

I would like to build a small fax component in Java or Perl. I have the javax.comm. (rxtx gnu.io) for Java for serial connection and get send a message to my fax were the light goes on and port is taken, but after that I am in the dark. Does anyone have some reference as to where I can get some... (1 Reply)
Discussion started by: photon
1 Replies

8. Solaris

fax hardware

hiho, do you know a hardware vendor which provide certified hardware for sun solaris/sparc with Class 2 or Class 1 compatible faxmodems pci-cards? i found many software for that purpose but no hardware... :( and the hcl on bigadmin only speaks about x86... thanks a lot greetings PRESSY (2 Replies)
Discussion started by: pressy
2 Replies

9. UNIX for Advanced & Expert Users

Fax on Solaris

Hi all, I am running an application on Solaris 8. I want to send the output from this application as fax. To achive this i need to do add the fax as a printer on the unix machine. I want to know is : - What are the settings required to be done in order to make my server able to send fax... (0 Replies)
Discussion started by: zing
0 Replies

10. UNIX for Dummies Questions & Answers

Fax Software

Do you know of any good and inexpensive Fax Software Package that can run on Unix and AIX? I will be using an external Modem attach to one of the system's serial port. I will be using it for sending faxes “only” Thanks for your help (1 Reply)
Discussion started by: falcon2460
1 Replies
Login or Register to Ask a Question