[LON-CAPA-admin] loncontrol from script

Stuart Raeburn raeburn at msu.edu
Thu Aug 1 01:11:59 EDT 2013


Hi,

> If, instead, from my computer I enter (or run a script with these commands):
>
> 	ssh root at myserver.org "service loncontrol start"
>
> or:
>
> 	ssh root at myserver.org "service loncontrol restart"
>
> loncontrol starts or restarts the LC, but the command does not exit,  
>  forcing me to manually terminate the command.

Use:

ssh -t root at myserver.org "service loncontrol start"

or:

ssh -t root at myserver.org "service loncontrol restart"


The reason for the difference in behavior when $ARGV is start or  
restart versus stop, is that in the former cases execution of  
loncontrol includes a system call:

system("su www -c '/home/httpd/perl/loncron --justcheckdaemons'");

and unless you include the -t option (force pseudo-tty allocation) for  
ssh, sshd apparently holds the connection open, even though the forked  
system command to run loncron has completed (and returned).


Stuart Raeburn
LON-CAPA Academic Consortium


Quoting Jon Hall <jdh65 at bellsouth.net>:

> If I ssh into my LC server, and run:
>
> 	service loncontrol start
>
> or:
>
> 	service loncontrol stop
>
> or:
>
> 	service loncontrol restart
>
> all works as expected.
>
>
>
> If, from my computer, I enter (or run a script with this command):
>
> 	ssh root at myserver.org "service loncontrol stop"
>
> the LC service stops exactly as expected, and the command exits normally.
>
>
>
> If, instead, from my computer I enter (or run a script with these commands):
>
> 	ssh root at myserver.org "service loncontrol start"
>
> or:
>
> 	ssh root at myserver.org "service loncontrol restart"
>
> loncontrol starts or restarts the LC, but the command does not exit,  
>  forcing me to manually terminate the command.
>
>
> Is this correct behavior? Or is there something that I am missing to  
>  get the command/script to exit properly?
>
> Thanks!
>




More information about the LON-CAPA-admin mailing list