On Mon, Jul 14, 2003 at 10:34:20AM +0530, Goutam Baul wrote:
>
> We are having a perl script that opens the serial port of the
> machine (/dev/ttys0), reads the data and writes onto a text
> file. Now in doing so we are having to run it with root user as
> the /dev/ttys0 is having access to root only. Should we change
> the permission of the /dev/ttys0 so that other user can open it?
The default permissions for /dev/ttys0 is 666. Normal users
should have access to it ... however ...
>
> The basic problem is that this script needs to run continuously
> in the background.
>
However, this may be the reason why permissions may have been
changed for strictly root access, so that there is no user
interference in the continuous data capture by root.
> But the script is dying after a few days and the system is not
> getting the proper data from the serial port.
Cannot say, but this should not happen. A continuous process
should not be spontaneously terminated. Does the script call
external processes without adequate error traps ?
> We tried to run the script from the inittab with respawn. Our
> thinking was that the script will be restarted as soon as it
> dies. But doing this resulted in having several instances of
> the script running in the system and eventually the system was
> getting out of resources. We are yet to get a solution for
> this. Any help in this direction please ?
If your intention is to restart the script in case it stops, an
alternate solution would be to run another script under
"watch". (man watch for details). All that this script should
do is to check for the ps output for your perl script. If the
ps output is null, start ther perl script again. You may set
the watch periodicity to 180 sec (or less if you so desire).
In any case this is not a solution to your problem. The
solution would lie in identifying the root cause for your perl
script packing up while in execution.
Just my 2p
Bish
--
:
####[ GNU/Linux One Stanza Tip (LOST) ]#######################
Sub : Capturing startx output LOST #008
To capture startx output : "$startx 1>startx.log 2>&1", or
"startx &>startx.log" ... This will dump a bunch of text to
the file "startx.log". View the output with pager or editor.
####[bish (at) nde.vsnl.net.in]###############################
:
-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help