RE: [U2] PHANTOM forever

2004-05-05 Thread George Gallen
not sure about windows...but on our RH linux system (to get
port.status to show all processes, not just yours, except if
your root),

I created the following:

PORT.STATUS
0001: EXECUTE sh -c 'sudo /usr/mbin/portstatus'
0002: STOP
0003: END

Then globablly cataloged it as *PORT.STATUS

My script /usr/mbin/portstatus is:

cd /usr/uv ; /usr/uv/bin/uv PORT2

And in UV

PORT2
0001: PA
0002: PORT.STATUS

So PORT.STATUS will show only your processes,
and *PORT.STATUS will show all processes since per the /etc/sudoers
  file entry, it will run as root regardless of the login name

/etc/sudoers entries will control who can run the sudo command, you
   can set it so certain logins don't need a password, others will require
   a password (sudo is nice in this regard).

(usernames have been replaced with x's below)

xxx ALL=(root) NOPASSWD:/usr/mbin/portstatus
xx  ALL=(root) NOPASSWD:/usr/mbin/portstatus

-
part2 - how to tell if a phantom is running!
--

First I have this script:

[EMAIL PROTECTED] mbin]$ cat show-phantoms
ps -eo command | grep phantom | awk '{print $2,$3,$4,$5,$6,
$7,$8}' | grep -v phantom | sort

And the basic program:

0001: EXECUTE 'sh -c /usr/mbin/show-phantoms' CAPTURING JUNK
0002: [EMAIL PROTECTED]
0003: IF INDEX(CMDLINE,-ON,1)#0 THEN DISPON=1 ELSE DISPON=0
0004: IF INDEX(CMDLINE,-OFF,1)#0 THEN DISPOFF=1 ELSE DISPOFF=0
0005: IF INDEX(CMDLINE,-STATUS,1)#0 THEN STATUS=1 ELSE STATUS=0
0006: MAX=DCOUNT(JUNK,CHAR(254))
0007: FOR T=MAX TO 1 STEP -1
0008:IF JUNKT= THEN DEL JUNKT
0009: NEXT T
0010: PROCESS=phantom name when started ; GOSUB 1000
0011: PROCESS=another phantom name to check ; GOSUB 1000
..
..
..
0026: STOP
0027: 1000:
0028:IF INDEX(JUNK,PROCESS,1)#0 AND (DISPON=1 OR STATUS=1) THEN PRINT
PROCE
 SS: ON
0029:IF INDEX(JUNK,PROCESS,1)=0 AND (DISPOFF=1 OR STATUS=1) THEN PRINT
PROC
 ESS: OFF
0030:RETURN
0031: END

My programs runs as CHECKPHANTOMS [-ON|-OFF|-STATUS]
-ON will show if it's running and supposed to be running
-OFF will show if it's not running and supposed to be running
-STATUS will show it's status

George

-Original Message-
From: Dennis Bartlett [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 05, 2004 2:25 AM
To: [EMAIL PROTECTED]
Subject: RE: [U2] PHANTOM forever


Speaking of this, we're currently on W2K, soon to move to
Linux (was
going to be RH9, but since that hit end-of-line, we return
to
investigation mode).

The question on W2K is how does one monitor/even see the
existence of
phantoms?
- A LISTU produces an opening statement 'there are 127
users, 126
interactive, 1 phantom' but no detail
- The PH file is great for post mortems


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Chuck Mongiovi
Sent: 04 May 2004 11:01
To: [EMAIL PROTECTED]
Subject: RE: [U2] PHANTOM forever


 What is you babysitter program?
---
u2-users mailing list
[EMAIL PROTECTED]
http://www.u2ug.org/listinfo/u2-users
---
u2-users mailing list
[EMAIL PROTECTED]
http://www.u2ug.org/listinfo/u2-users


RE: [U2] PHANTOM forever

2004-05-03 Thread John Reid
Have her (him) chain itself?
j

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dana Baron
Sent: Monday, May 03, 2004 12:35 PM
To: U2-Users
Subject: [U2] PHANTOM forever

Greetings,

Looking for some advice with Phantoms (seems to be a theme lately). I have a
udt program that I want to have always running (infinite loop). I want to
start this as a background process using PHANTOM. Pretty straight forward so
far. How can I do this so the process keeps running even after I log out the
process that started it?

Unidata 5.2;   Tru64 Unix 5.1A

Thanks for any help

Dana Baron
System Manager
Smugglers' Notch Resort



---
u2-users mailing list
[EMAIL PROTECTED]
http://www.u2ug.org/listinfo/u2-users


This e-mail, including attachments, may include confidential and/or 
proprietary information, and may be used only by the person or entity to 
which it is addressed. If the reader of this e-mail is not the intended 
recipient or his or her authorized agent, the reader is hereby notified 
that any dissemination, distribution or copying of this e-mail is 
prohibited. If you have received this e-mail in error, please notify the 
sender by replying to this message and delete this e-mail immediately. 

---
u2-users mailing list
[EMAIL PROTECTED]
http://www.u2ug.org/listinfo/u2-users


RE: [U2] PHANTOM forever

2004-05-03 Thread Keith Johnson
Title: RE: [U2] PHANTOM forever






Dana,

How about trying a cron job or looking in to your inittab man pages?

I personally have never wanted to make an infinite loop, however I have made my share on accident.

I am sure this type of logic will do the trick but it might just run away and spawn so many jobs that you have no resources or UNIDATA Lic for your users.

LOOP 

PHANTOM {WORK HERE program or PA etc} 

REPEAT 

# No conditional 

# I personally would be very careful with this. One miss step here and you might just regret this later. 

A better way would likely be researching making the process a daemon... (from my AIX Man pages)

Files Reference 

 

--- 

 

inittab File 

 

Purpose 

 

Controls the initialization process. 

 

Description 

 

The /etc/inittab file supplies the script to the init command's role as a 

general process dispatcher. The process that constitutes the majority of the 

init command's process dispatching activities is the /etc/getty line process, 

which initiates individual terminal lines. Other processes typically dispatched 

by the init command are daemons and the shell.


Keith Johnson

Systems AdministratorProgrammer / Analyst

Lewis-Clark State College (LCSC) 208.792.2510

500 8th Ave. 

Lewiston, ID 83501



-Original Message-
From: Dana Baron [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 03, 2004 9:35 AM
To: U2-Users
Subject: [U2] PHANTOM forever

Greetings,

Looking for some advice with Phantoms (seems to be a theme lately). I have a

udt program that I want to have always running (infinite loop). I want to

start this as a background process using PHANTOM. Pretty straight forward so

far. How can I do this so the process keeps running even after I log out the

process that started it?

Unidata 5.2; Tru64 Unix 5.1A

Thanks for any help

Dana Baron

System Manager

Smugglers' Notch Resort



---

u2-users mailing list

[EMAIL PROTECTED]

http://www.u2ug.org/listinfo/u2-users




Re: [U2] PHANTOM forever

2004-05-03 Thread John Hester
Dana Baron wrote:
Greetings,
Looking for some advice with Phantoms (seems to be a theme lately). I have a
udt program that I want to have always running (infinite loop). I want to
start this as a background process using PHANTOM. Pretty straight forward so
far. How can I do this so the process keeps running even after I log out the
process that started it?
One way I've handled this in UV is to create a logon for the phantom 
process and check the @TTY variable within the process itself.  If @TTY 
= phantom then I go into the loop, otherwise I execute the PHANTOM 
command to spawn another copy and let the current process terminate.

If you want to insure the process is always running, even after a 
reboot, you can have a shell script run by cron start the phantom 
process.  Just write a flag to a flat file somewhere when the process 
starts and check it in the cron script to avoid starting more than 1 
process.  You still have to remember to remove the flag prior to a 
system shutdown though, or you could add a startup script (/etc/init.d 
for most *nixes) to remove it.

-John
---
u2-users mailing list
[EMAIL PROTECTED]
http://www.u2ug.org/listinfo/u2-users


RE: [U2] PHANTOM forever

2004-05-03 Thread Gordon Glorfield
Whenever I've had to create a phantomed loop like this, I always put in a
'kill switch'.  This kill switch reads an item from a parameters file.  If
this item is empty then the program continues to run.  If, however, the
parameter item contains anything, the program then gracefully terminates
itself.


Gordon J. Glorfield
Sr. Applications Developer
MAMSI (A UnitedHealth Company)
301-360-8839


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Keith Johnson
Sent: Monday, May 03, 2004 2:17 PM
To: [EMAIL PROTECTED]
Subject: RE: [U2] PHANTOM forever


Dana,
How about trying a cron job or looking in to your inittab man pages?
I personally have never wanted to make an infinite loop, however I have made
my share on accident.
I am sure this type of logic will do the trick but it might just run away
and spawn so many jobs that you have no resources or UNIDATA Lic for your
users.
LOOP   
PHANTOM {WORK HERE program or PA etc}  
REPEAT 
# No conditional  
# I personally would be very careful with this.  One miss step here and you
might just regret this later. 
A better way would likely be researching making the process a daemon...
(from my AIX Man pages)
Files Reference

 


--- 
 

inittab File

 

Purpose

 

Controls the initialization process.

 

Description

 

The /etc/inittab file supplies the script to the init command's role as a

general process dispatcher. The process that constitutes the majority of the

init command's process dispatching activities is the /etc/getty line
process,   
which initiates individual terminal lines. Other processes typically
dispatched 
by the init command are daemons and the shell.


[SNIP]


This e-mail, including attachments, may include confidential and/or 
proprietary information, and may be used only by the person or entity to 
which it is addressed. If the reader of this e-mail is not the intended 
recipient or his or her authorized agent, the reader is hereby notified 
that any dissemination, distribution or copying of this e-mail is 
prohibited. If you have received this e-mail in error, please notify the 
sender by replying to this message and delete this e-mail immediately. 

---
u2-users mailing list
[EMAIL PROTECTED]
http://www.u2ug.org/listinfo/u2-users


RE: [U2] PHANTOM forever

2004-05-03 Thread Dean.Armbruster
 On Behalf Of Dana Baron
 Sent: Monday, May 03, 2004 2:59 PM
 To: U2-Users
 Subject: RE: [U2] PHANTOM forever
 
 I have a Unidata Basic program (called MESSAGE_LOOP) that needs to
 constantly check for messages deposited into a particular 
 directory. It is
 an endless loop that checks for messages, processes any it 
 finds, sleeps for
 a second, then does it again. I need to start this process up 
 and leave it
 running forever. I found the nohup command on Tru64 that 
 executes a script
 with the following line.
 
 udt PHANTOM MESSAGE_LOOP 
 
 Works fine for starting up the job. The problem is that the 
 job now gobbles
 up 80% of the CPU. How can I reduce this process's hunger for 
 CPU so that it
 can share nicely with others? Should I set the priority lower 
 or should I
 increase the sleep time inside the program?


Increasing the sleep time is probably your best bet, but here are some suggestions 
that may help, if you can implement them.

1. Change the directory to a hashed file.  Processing directories is significantly 
slower than hashed files, particularly with whole file queries such as SELECT and 
LIST.  This would only be easy to do if the messages are being written by a UniData 
process.

2. Use PAUSE instead of SLEEP.  PAUSE by works similarly to SLEEP, with two exceptions.

The first exception is that the PAUSEd process can be awakened early by another 
process via the WAKE command.  This means that the process writing the message could 
WAKE the phantom to tell it to process, therefore the PAUSE time could be very large 
and the phantom would only do work when needed.  (The unix gurus out there know that 
SLEEP can also be awakened via a kill command, but that is a different beast.)

The second exception is that the time of the PAUSE is not as exact as SLEEP.  The time 
is rounded up to the next 10 second interval.  This is because PAUSEs are handled by 
the cleanupd daemon instead of a system alarm, and cleanupd checks the pause list at 
intervals.  The default interval is 10 seconds, but it can be changed by changing the 
startup command for cleanupd in the startud script.  We changed ours to 3 seconds.  
The fact that the time is rounded up a few seconds has very little impact here because 
most of our paused processes are awakened before the time limit or the time limit is 
not critical.

We have over a dozen phantom processes that are always running in the background, 
doing things similar to your process.  Most of them are using PAUSE/WAKE, or are 
sleeping for 30 second intervals.

HTH,
Dean
---
u2-users mailing list
[EMAIL PROTECTED]
http://www.u2ug.org/listinfo/u2-users


RE: [U2] PHANTOM forever

2004-05-03 Thread Adrian . Womack
We have many phantoms doing various stuff in the background. We're running
Universe (and previously PI/Open) and we have to do nothing special to get
these phantom processes to keep running when the parent process is logged
out.

All we do is the standard PHANTOM program.id. 

Maybe under UniData there's a problem with the parent logging out - but not
under UniVerse.

AdrianW


-Original Message-
From: Sara Burns [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 4 May 2004 09:19
To: U2 List ([EMAIL PROTECTED])
Subject: RE: [U2] PHANTOM forever


We discovered this problem with our phantom which sends data to Oracle.  We
have developed a double stage method to disconnect it from the user.

Initially we write the command to launch the phantom to a file - we call
ours SCRIPTS, which contains the command of the structure
echo program name  | /uv/bin/uv ./\PH\/name of log file in PH) 21 

Then we have an item in the VOC which contains
SH -c 'full path to the item in SCRIPTS'

Our initialisation program writes the entry in SCRIPTS then executes the
item in the VOC.  In the past we extended this to be able to run multiple
phantoms doing the same job.  Improved hardware means we don't need
multiples now.

This was originally developed using UniData and we have since ported it to
UniVerse.  It works well.

Sara Burns (SEB) 
Development Team Leader
Public Trust 
Phone: +64 (04) 474-3841 (DDI) 
Mobile: 027 457 5974
mailto:[EMAIL PROTECTED]
Information contained in this communication is confidential. If you are not
the intended recipient the information should not be used, disclosed, copied
or commercialised. The information is not necessarily the views nor the
official communication of Public Trust. No guarantee or representation is
made that the communication is free of errors, virus or interference.
Disclaimer.  This e-mail is private and confidential. If you are not the
intended recipient, please advise us by return e-mail immediately, and
delete the e-mail and any attachments without using or disclosing the
contents in any way. The views expressed in this e-mail are those of the
author, and do not represent those of this company unless this is clearly
indicated. You should scan this e-mail and any attachments for viruses. This
company accepts no liability for any direct or indirect damage or loss
resulting from the use of any attachments to this e-mail.
---
u2-users mailing list
[EMAIL PROTECTED]
http://www.u2ug.org/listinfo/u2-users