- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Script help - Vsifax
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 08:26 AM
08-13-2001 08:26 AM
I need help writing a script. We have an application called VSIFax running on our system. It is a fax server. Well the server dies (software stops running, not the actual Unix server!).
To check if the VSIFax software is running I type
#vfxstat -r
If it says the server is down I can re-start it by typing
#vfxsched start
What or how do I write a script to periodically check if the
software is up, if not then to re-start it.
I have a similar problem with a printer that for some reason gets disabled? I want to check to see if the printer is disabled, if so then to enable it.
I know a script will accomplish this, and I can schedule the script in crontab. But I have barely any idea how to write the script (even though I bet it is easy).
Any help would be appreciated.
Thanks,
Troy Hicks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 08:57 AM
08-13-2001 08:57 AM
Re: Script help - Vsifax
If I assume that the process running is called "VSIFax" then I could write something like this:
if [ -z "`UNIX95= ps -C VSIFax|awk 'NR>1 {print $1}'`" ]
then
echo "Fax process isn't running!"
else
echo "Fax process is alive"
fi
For the printer you want to check, you could do something like:
if [ `lpstat -p|awk '/myprinter/ {print $3}'` = disabled ]
then
echo "printer is disabled"
else
echo "printer is enabled"
fi
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 09:23 AM
08-13-2001 09:23 AM
Re: Script help - Vsifax
On making a script to restart vsifax, I think it came with one (vfxstart.sh?). There is an environmental file (under /etc) you need to source in your reset script. (i.e.
#!/bin/ksh
. /etc/vsifax.env
There should be a spot where the inbound and outbound faxes are copied to. Maybe this area is full?
Just some ideas.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 09:25 AM
08-13-2001 09:25 AM
Re: Script help - Vsifax
You are in luck. I happen to run vsifax. Your script should look very much like this
#!/usr/bin/sh
VSIFAX=/opt/vsifax3
PATH=${PATH}:/usr/bin:/usr/sbin:${VSIFAX}/bin
export VSIFAX PATH
STAT=0
vfxstat -r | grep -q "is running"
VSTAT=$?
if [ ${VSTAT} -ne 0 ]
then
vfxsched start
STAT=$?
fi
exit ${STAT}
That should do it, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 10:30 AM
08-13-2001 10:30 AM
Re: Script help - Vsifax
#!/usr/bin/sh
if [`lpstat -p|awk '/lp17/ {print $3}'` = disabled ]
then
enable lp17
fi
But when I run it I get this message:
(When the printer is already disabled)
/rd/bin/enablelp17[3]: [disabled: not found.
When the printer is enabled already I get this:
/rd/bin/enablelp17[3]: [is: not found.
For the vsifax server script I used the one from Clay. Here it is:
#!/usr/bin/sh
VSIFAX=/opt/vsifax3
PATH=${PATH}:/usr/bin:/usr/sbin:${VSIFAX}/bin
export VSIFAX PATH
STAT=0
vfxstat -r | grep -q "is running"
VSAT=$?
if [ ${VSTAT} -ne 0 ]
then
vfxsched start
STAT=$?
fi
exit ${STAT}
When I run that script I get this result:
/rd/bin/vsifaxchecker[11]: test: Specify a parameter with this command.
So I either have not entered them in correctly, or am not running the script right, or something.
I need more help!
Thanks,
Troy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 10:39 AM
08-13-2001 10:39 AM
Re: Script help - Vsifax
In the case of the Vsifax script, the VSIFAX env var was set to my location; yours may be different.
I think your other problem is related to the if syntax. There must be at least one space after the '[' and at least one space before the ']'.
Hope this helps, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 10:55 AM
08-13-2001 10:55 AM
Re: Script help - Vsifax
The error you recieved means your test failed due to unknown variable.
The line above your test needs to be changed to VSTAT=$? verses VSAT=$?
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 11:08 AM
08-13-2001 11:08 AM
Re: Script help - Vsifax
I think you are grabbing the wrong variable. Plus make sure your have your PATH setup correctly.
I am fairly confident the it should be awk /lp17/{print $5}/
...jcd...
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 11:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 11:14 AM
08-13-2001 11:14 AM
Re: Script help - Vsifax
Troy: One thing that I would suggest is that you get these scripts working perfectly from an interactive shell before you try them under cron. Cron's enviroment is very sparse so after you get them working as expected from an interactive shell you then only have to make sure that your have defined and exported PATH and any other variables.
Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 12:28 PM
08-13-2001 12:28 PM
Re: Script help - Vsifax
Thanks for your responses, I will implement the suggestions right now.
Troy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 12:52 PM
08-13-2001 12:52 PM
Re: Script help - Vsifax
Thanks a lot.
Troy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2001 06:24 PM
08-13-2001 06:24 PM
Re: Script help - Vsifax
What UNIX95 and -C means in the cripts.
Thanks
Nisar Ahmad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2001 11:56 AM
08-14-2001 11:56 AM
Re: Script help - Vsifax
My fax device name is "fax1" you'll need to change it. The script as written sends email to "watchdog" so change that too. Also my install directory is /opt/vsifax3, change it to be appropriate for your install.
It uses a couple of standard VSIFax utilities to try to determine if the server is up and status is good. Hope this helps.
I run it in root cron, every hour or so.
Also see the VSIFax website about purging on a regular basis, otherwise file systems get full.