Re: exec question

2006-09-21 Thread Dave Shield
On 20/09/06, danny zhong [EMAIL PROTECTED] wrote:
 so what i need to do is just put all the starting and
 stoping script in the /etc/init.h/

Write a script that will start/stop the daemons appropriately - yes.
It doesn't actually matter where you put this script.

I'm suggesting that you use the /etc/init.d scripts as a model, since
this provides a good template for the way this can be done.  Plus if
you write it in this form, you can then use the same script to start
the daemons automatically, if you decide you want to work that way.
(I'm a lazy beggar at times, and it's often easier to Do It Right first time)

   and then use the procfix with setting the
 prErrFix to 1, in order to call the starting or stoping script?

Correct.

just for making sure, will the procfix only do trigger, or it
 will wait for the triggered process finished.

It will run the start/stop script, and then return.
Whether it waits for the triggered process to finish, depends on how
you write this script (and the daemon processes themselves).   If
you're developing the daemons cleanly, they should detach themselves
from the controlling terminal, and fork off a child to actually do the
work, allowing the initial process to exit.   Or you could have the
start/stop script invoke the daemon(s) as a subprocess, running in the
background, so the script can exit and leave the daemons running.

But this is getting away from SNMP-specific stuff.  It's really just
general network service programming issues.


Dave

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: exec question

2006-09-20 Thread Dave Shield
On 20/09/06, danny zhong [EMAIL PROTECTED] wrote:
 int main(void){
 while(1){

 }
 }

 and i put the execution command of this file in  a script file called
 run.sh, in the snmpd.conf, i add

 exec .1.3.6.1.4.1.2021.53 run /bin/sh /home/danny/run.sh

No - that won't work.
exec is designed to run a command to completion, and report the results.
If you've got a long-running program, then you can't use the
simplistic exec approach.

Take a step backwards - what exactly are you trying to do?

Dave

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: exec question

2006-09-20 Thread danny zhong


since the daemon program is in the remote site computer, and i don't want 
the daemon program start when the remote computer start. i only want the 
daemon program start when i triggered it. Actually, in my project, there 
are more daemon program need to be triggered in the same remote computer 
and other remote computer as well. and some of these daemon program need to 
be trigger in order.  For easer to manage, i want a snmp agent can do it 
for me.

how about if i develop an agent by using the API, which only need to 
trigger the daemon programs, and then will return a packet without 
waitting for the finish of daemon program like your exec. if it is 
possible, then can you just tell me what kind of api function i can use or 
need to modify??








what i am trying to do at the moment is to run a remote site daemon program.
this daemon program is used to receive video metadata from other computer.


OK.
Starting/Stopping that daemon is best handled by something other than 
exec.
You don't say what O/S you're using - but if this is a Unix-like
system, then I'd suggest you write a simple /etc/init.d/videodaemon
script to start/stop the daemon.
  That would give you much more flexible control than a purely
SNMP-based approach.

Use the existing startup scripts as a template.

also i want to use net snmp to monitor this program is running properly.


That's different from actually starting the problem.

Could you please give me some hints.


Have a look at the 'proc' directive (in snmpd.conf(5)).
This will report whether a particular process is running or not.

Dave


From: Dave Shield [EMAIL PROTECTED]
To: danny zhong [EMAIL PROTECTED]
CC: net-snmp-users@lists.sourceforge.net
Subject: Re: exec question
Date: Wed, 20 Sep 2006 09:04:52 +0100

On 20/09/06, danny zhong [EMAIL PROTECTED] wrote:
  int main(void){
  while(1){
 
  }
  }
 
  and i put the execution command of this file in  a script file called
  run.sh, in the snmpd.conf, i add
 
  exec .1.3.6.1.4.1.2021.53 run /bin/sh /home/danny/run.sh

No - that won't work.
exec is designed to run a command to completion, and report the results.
If you've got a long-running program, then you can't use the
simplistic exec approach.

Take a step backwards - what exactly are you trying to do?

Dave

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share 
your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


_
Nothing but cars  over 100,000 of them at carsales.com.au 
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801577%2Fpi%5F1005244%2Fai%5F836752_t=12345_r=emailtagline_tig_over100k_m=EXT


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: exec question

2006-09-20 Thread Dave Shield
On 20/09/06, danny zhong [EMAIL PROTECTED] wrote:
 since the daemon program is in the remote site computer, and i don't want
 the daemon program start when the remote computer start. i only want the
 daemon program start when i triggered it.

Fair enough.
I'd still recommend that you write a simple init.d-style script to
start/stop the daemon.
This wouldn't have to be activated automatically on boot-up (though it
would give you that option in the future, if you decided to change the
way you worked).
  But that would allow you to tackle the two development tasks separately:

a)  starting (or stopping) the daemon cleanly
   (which you could do manually until you got it working cleanly)
b)  triggering this via SNMP
   (invoking the script developed in a))


   Actually, 
 in my project, there
 are more daemon program need to be triggered in the same remote computer
 and other remote computer as well. and some of these daemon program need to
 be trigger in order.

Which is something that the init.d script could look after.


For easer to manage, i want a snmp agent can do it 
 for me.

See b) above.


 how about if i develop an agent by using the API, which only need to
 trigger the daemon programs, and then will return a packet without
 waitting for the finish of daemon program like your exec.

I'd actually suggest that you don't use exec at all.
This feels much more appropriate for the proc/procfix directives.
proc could be used to check whether the daemon is currently running or not.
procfix could be used to invoke the startup script if necessary.

Dave

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users


Re: exec question

2006-09-20 Thread danny zhong


thanks for your reply. so what i need to do is just put all the starting and 
stoping script in the /etc/init.h/ and then use the procfix with setting the 
prErrFix to 1, in order to call the starting or stoping script? am i 
correct? just for making sure, will the procfix only do trigger, or it 
will wait for the triggered process finished.









On 20/09/06, danny zhong [EMAIL PROTECTED] wrote:
since the daemon program is in the remote site computer, and i don't want
the daemon program start when the remote computer start. i only want the
daemon program start when i triggered it.

Fair enough.
I'd still recommend that you write a simple init.d-style script to
start/stop the daemon.
This wouldn't have to be activated automatically on boot-up (though it
would give you that option in the future, if you decided to change the
way you worked).
  But that would allow you to tackle the two development tasks separately:

a)  starting (or stopping) the daemon cleanly
   (which you could do manually until you got it working cleanly)
b)  triggering this via SNMP
   (invoking the script developed in a))


   
Actually, in
my project, there
are more daemon program need to be triggered in the same remote computer
and other remote computer as well. and some of these daemon program need to
be trigger in order.

Which is something that the init.d script could look after.


For easer to manage, i want a snmp agent can do 
it
for me.

See b) above.


how about if i develop an agent by using the API, which only need to
trigger the daemon programs, and then will return a packet without
waitting for the finish of daemon program like your exec.

I'd actually suggest that you don't use exec at all.
This feels much more appropriate for the proc/procfix directives.
proc could be used to check whether the daemon is currently running or 
not.





///

procfix could be used to invoke the startup script if necessary.

Dave

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users



From: danny zhong [EMAIL PROTECTED]
To: net-snmp-users@lists.sourceforge.net
Subject: Re: exec question
Date: Thu, 21 Sep 2006 00:20:54 +1000



since the daemon program is in the remote site computer, and i don't want
the daemon program start when the remote computer start. i only want the
daemon program start when i triggered it. Actually, in my project, there
are more daemon program need to be triggered in the same remote computer
and other remote computer as well. and some of these daemon program need to
be trigger in order.  For easer to manage, i want a snmp agent can do it
for me.

how about if i develop an agent by using the API, which only need to
trigger the daemon programs, and then will return a packet without
waitting for the finish of daemon program like your exec. if it is
possible, then can you just tell me what kind of api function i can use or
need to modify??








what i am trying to do at the moment is to run a remote site daemon 
program.
this daemon program is used to receive video metadata from other computer.


OK.
Starting/Stopping that daemon is best handled by something other than
exec.
You don't say what O/S you're using - but if this is a Unix-like
system, then I'd suggest you write a simple /etc/init.d/videodaemon
script to start/stop the daemon.
   That would give you much more flexible control than a purely
SNMP-based approach.

Use the existing startup scripts as a template.

 also i want to use net snmp to monitor this program is running 
properly.


That's different from actually starting the problem.

 Could you please give me some hints.


Have a look at the 'proc' directive (in snmpd.conf(5)).
This will report whether a particular process is running or not.

Dave


 From: Dave Shield [EMAIL PROTECTED]
 To: danny zhong [EMAIL PROTECTED]
 CC: net-snmp-users@lists.sourceforge.net
 Subject: Re: exec question
 Date: Wed, 20 Sep 2006 09:04:52 +0100
 
 On 20/09/06, danny zhong [EMAIL PROTECTED] wrote:
   int main(void){
   while(1){
  
   }
   }
  
   and i put the execution command of this file in  a script file called
   run.sh, in the snmpd.conf, i add
  
   exec .1.3.6.1.4.1.2021.53 run /bin/sh /home/danny/run.sh
 
 No - that won't