Gary,
I tried the code you posted, and it has the same problem mine did.
tyler
On Tue, 2002-06-18 at 11:17, Gary Stainburn wrote:
> On Tuesday 18 June 2002 5:08 pm, Tyler Longren wrote:
> > Hello,
>
> Hi,
>
> >
> > I have an smp machine that I want to run two instances of setiathome
> > on. I have two s@h directories (/root/.setiathome and
> > /root/.setiathome2). I wrote this to run both of them at the same time
> > right from one script. If I use the -a flag to run both of them, it
> > never moves on to start the setiathome in $setiathome2_dir.
> >
>
> Your problem is that you script will never return from the first time it
> calls setiathome. You need to fork a new process to do that.
>
> Two points to note
>
> 1) the '&' added to the backtick
> 2) never use your system as root. Even if you're the only user, create and
> use another account. Only use 'root' for SysAdmin stuff. One day you WILL
> regret it.
>
> try something like (not tested)
>
> #!/usr/bin/perl -w
> use strict;
> use Getopt::Std;
> getopts("12a",\my %options);
>
> if (defined $options{1} || defined $options{a}) {
> &startit('/root/.setiathome/');
> }
>
> if (defined $options{2} || defined $options{a}) {
> &startit('/root/.setiathome2/');
> }
>
> sub startit {
> my ($dir)=@_;
> chdir ($dir);
> `./setiathome -proxy 192.168.1.3:5517 &`;
> }
>
> > How can I make it so both s@h clients get started?
> >
> > ----Begin Code----
> > #!/usr/bin/perl -w
> > use strict;
> > use Getopt::Std;
> > getopts("12a", \my %options);
> > sub usage {
> > print "Usage: ./seti.pl [-1] [-2] [-a]
> > -1 : Start the first directory of setiathome
> > -2 : Start the second directory of setiathome
> > -a : Start both setiathome clients\n\n";
> > }
> > my $setiathome1_dir = "/root/.setiathome/";
> > my $setiathome2_dir = "/root/.setiathome2/";
> > sub setiathome1 {
> > `cd $setiathome1_dir; ./setiathome -proxy 192.168.1.3:5517`;
> > }
> >
> > sub setiathome2 {
> > `cd $setiathome2_dir; ./setiathome -proxy 192.168.1.3:5517`;
> > }
> >
> > if (defined $options{1}) {
> > setiathome1;
> > exit;
> > }
> > elsif (defined $options{2}) {
> > setiathome2;
> > exit;
> > }
> > elsif (defined $options{a}) {
> > setiathome1;
> > setiathome2;
> > exit;
> > }
> > else {
> > usage;
> > exit;
> > }
> > -----End Code----
> >
> > If a better explanation is desired, e-mail me directly.
> >
> > Thanks,
>
> --
> Gary Stainburn
>
> This email does not contain private or confidential material as it
> may be snooped on by interested government parties for unknown
> and undisclosed purposes - Regulation of Investigatory Powers Act, 2000
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]