There might be an error in starting up your second mud; system()
[according to the man page on my machine] returns an error if this
is the case, but you're ignoring it. Also, since the path to your port
B binary is a relative one, keep in mind that CircleMUD changes its
directory upon startup, generally to your lib directory. (A -d newdir
command-line option can change this location.)
You might also want to consider not using system() and using fork()
with execl() instead. This would be a little less overhead and would
not require a shell to be in the middle. To do this, you'd replace
your sprintf/system with:
int return_value = fork();
if (return_value==0) {
/* this code is only reached by the child process which must execl */
char main_pid[16];
nice(20); /* you had a nice request in your system call */
sprintf(main_pid,"%d",getppid()); /* getppid is not a typo here */
return_value = execl("../../circle30bpl14/bin/temple.current", main_pid);
if (return_value < 0) {
/* log an error message; parameter problems, etc., to execl() will
cause errors here */
}
} else if (return_value < 0) {
/* log a failure message - couldn't fork. this will rarely happen */
} else {
/* log a success message; return_value is the pid of port B */
}
It's a few more lines of code, but it gives you better return information.
At 05:47 PM 12/30/98 +1000, you wrote:
>Hi...I'm trying to create a command (if poss.) which'll boot another port
>of mine up when I'm online. I.e. boot port B when I'm active on port A...
>
>My code looks like:
>
>***SNIP***
>ACMD(do_bootup)
>{
> char buf[100];
>
> sprintf(buf, "nice ../../circle30bpl14/bin/temple.current %d &", (int)
>getpid());
> system(buf);
> mudlog("Booting up Port 1502...", CMP, LVL_IMPL, FALSE);
> send_to_char(OK, ch);
>}
>***END***
>
>I figure there's something wrong in the sprintf line...the mudlog shows up
>fine, but the binary doesnt get called.
>
>Can anyone help?
>
>-----------------------------------------------------------------
> Julian Buckley, 3rd Year Computer Systems Engineering
> Dept. Computer Science and Electrical Engineering, Univ. of Qld
> E-Mail: s348266@student.uq.edu.au
> Web Page: http://student.uq.edu.au/~s348266/index.html
>-----------------------------------------------------------------
>
>
> +------------------------------------------------------------+
> | Ensure that you have read the CircleMUD Mailing List FAQ: |
> | http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
> +------------------------------------------------------------+
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST