server countdown and shutdown of 5mins

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 096.
Note: Core 096 is no longer officially supported.
Post Reply
snick
New User
Posts: 13
Joined: Sun Oct 29, 2006 12:05 am

server countdown and shutdown of 5mins

Post by snick »

I've looked and haven't found an answer. How do I implement this in the console or is it implemented already? I want it to notify players that server will shutdown in 5 mins to be restarted and to then countdown and shutdown.
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

Take a look in the config/consoles.cfg file. In amongst the commands are these:

Code: Select all

Commands
{
	CMD 1 shutdown Shutdown in 6 minutes
	CMD 2 shutdown Shutdown in 12 minutes
	CMD 3 shutdown Shutdown in 18 minutes
	CMD 4 shutdown Shutdown in 24 minutes
	CMD 5 shutdown Shutdown in 30 minutes
	CMD 6 shutdown Shutdown in 36 minutes
	CMD 7 shutdown Shutdown in 42 minutes
	CMD 8 shutdown Shutdown in 48 minutes
	CMD 9 shutdown Shutdown in 54 minutes
	CMD 0 shutdown Shutdown in 60 minutes
}

Then write a script in scripts/console to do the shutdown called shutdown.src. The following is an example and doesn't do exactly what you want but it's a good start. (This is either from an old distro or the WorldOfDreams scripts, not sure which:)

Code: Select all

use uo;
use os;
use util;

include "include/clock";


program console_shutdown(cmd)
	cmd := CInt(cmd);
	var basetime;
	var nexttime;
	var i;
	case ( cmd )
		0: basetime := 60;
		1: basetime := 6;
		2: basetime := 12;
		3: basetime := 18;
		4: basetime := 24;
		5: basetime := 30;
		6: basetime := 36;
		7: basetime := 42;
		8: basetime := 48;
		9: basetime := 54;
	endcase

	for ( i := 1; i <= 3; i += 1 )
		nexttime := basetime - (( basetime / 3) * (i - 1));
		print("System Message: " + nexttime + " minutes to shutdown!");
		foreach onlinechr in EnumerateOnlineCharacters()
			SendSysMessage(onlinechr, "System Message: " + nexttime + " minutes to shutdown!", 3, 38);
		endforeach
		sleep(60 * basetime / 3);
	endfor
	Shutdown();
endprogram


I find I don't use the console though. For admin purposes I find it more convenient to use the internal pol webserver and manage it from there.
snick
New User
Posts: 13
Joined: Sun Oct 29, 2006 12:05 am

Post by snick »

thank you very much that wasn't included in the wod scripts I have. I'm trying to get that webserver up but it says page not found......the address I'm putting in my browser is http://ip:5002 Is this correct?
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

That depends on your pol.cfg entry for the port.

http://127.0.0.1:5002 should work on the server if the defaults are then and the www server enabled in pol.cfg. Of course you need something in scripts/www/ for anything to be displayed.
snick
New User
Posts: 13
Joined: Sun Oct 29, 2006 12:05 am

Post by snick »

Yes something is in the www folder from wod but still i'm getting page not found. My firewall isn't blocking my access to this computer? Seems strange that it would block me from my own computer but will check it.

Code: Select all

#############################################################################
## Integrated Web Server
#############################################################################

#
# WebServer: in multithread mode only, run the internal web server
#            This may be a security risk.  It's susceptible to DoS attacks.
#            If someone knows a little about TCP/IP, they could cause you
#            trouble if it's enabled.
#
WebServer=1

#
# WebServerPort: What TCP/IP port to listen for web requests
#
WebServerPort=5002

#
# WebServerLocalOnly: Only allow access from localhost
#
WebServerLocalOnly=1

#
# WebServerDebug: Print trace information about http requests
#
WebServerDebug=0

#
# WebServerPassword: username/password required for access to the web server.
#                    if not specified, no password is required.
#
WebServerPassword=tweedledum/tweedledee
[/quote]
snick
New User
Posts: 13
Joined: Sun Oct 29, 2006 12:05 am

Post by snick »

Now i'm getting the user/pw box to come up but it won't take the pw....have I got that in right? I can get on the webserver now. I took the pw out and added index.html to that address.
Last edited by snick on Thu Sep 06, 2007 8:17 pm, edited 1 time in total.
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

If your internet web server is for local only, there isn't really a need for a password is there?

Don't know, haven't used it.
Try
WebServerPassword=tweedledum:tweedledee
snick
New User
Posts: 13
Joined: Sun Oct 29, 2006 12:05 am

Post by snick »

I just took it out but may try the way you have it.
Post Reply