From 3c279d6c3b66a7f5ad49e16180b69ffa94513dc5 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 8 Nov 2016 22:17:09 +1000 Subject: Installation script. --- config/ROBUST/opensim-monit.conf | 36 +++ config/Robust.Tests.ini | 468 --------------------------------------- config/config.ini | 2 +- config/sim01/My_sim.xml | 11 + config/sim01/ThisSim.ini | 6 + config/sim01/opensim-monit.conf | 29 +++ 6 files changed, 83 insertions(+), 469 deletions(-) create mode 100644 config/ROBUST/opensim-monit.conf delete mode 100644 config/Robust.Tests.ini create mode 100644 config/sim01/My_sim.xml create mode 100644 config/sim01/ThisSim.ini create mode 100644 config/sim01/opensim-monit.conf (limited to 'config') diff --git a/config/ROBUST/opensim-monit.conf b/config/ROBUST/opensim-monit.conf new file mode 100644 index 0000000..70190b9 --- /dev/null +++ b/config/ROBUST/opensim-monit.conf @@ -0,0 +1,36 @@ +# manage the OpenSim process for Your Sim +# +# usage: +# monit start your_sim +# monit stop your_sim +# monit restart your_sim +# +# see 'daemon' setting in /etc/monit/monitrc for the cycle length. +# on ubuntu/debian, this is overridden by the CHECK_INTERVALS var in +# /etc/default/monit . the below assumes you've set it to 30 seconds. +# +# if process dies, will restart sim within 30 seconds. if process +# dies 5 times in as many tries, will stop trying and send email +# alert. +# +# if SimFPS drops to 0 for 2 minutes, restart. +# +# if process CPU usage stays above 300% for 2 minutes, restart. +# +# see ../README for configuration instructions. +# +# Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. +# +check process ROBUST with pidfile /var/run/opensim/ROBUST.pid + start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/ROBUST && /opt/opensim/config/ROBUST/start-sim -q'" + as uid root and gid root + stop program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/ROBUST && /opt/opensim/config/ROBUST/stop-sim'" with timeout 600 seconds + if cpu usage > 50% for 4 cycles then restart +# if 5 restarts within 5 cycles then timeout +# if failed url http://127.0.0.1:9005/jsonSimStats/ +# and content != '"SimFPS":0.0,' for 4 cycles +# then restart +# if failed url http://127.0.0.1:9008/jsonSimStats/ +# and content == '"SimFPS":' for 4 cycles +# then restart + diff --git a/config/Robust.Tests.ini b/config/Robust.Tests.ini deleted file mode 100644 index c25e39b..0000000 --- a/config/Robust.Tests.ini +++ /dev/null @@ -1,468 +0,0 @@ -; * FOR TESTS ONLY -- DO NOT USE THIS FILE -[Const] - - ; The URL of the Robust server - BaseURL = "http://127.0.0.1" - - ; The public port of the Robust server - PublicPort = "8888" - - ; The private port of the Robust server, same for testing - PrivatePort = "8888" - - -; * The startup section lists all the connectors to start up in this server -; * instance. This may be only one, or it may be the entire server suite. -; * Multiple connectors should be separated by commas. -; * -; * These are the IN connectors the server uses, the in connectors -; * read this config file and load the needed service and database connectors -; * -; * The full syntax of a connector string is: -; * [[@]/][:] -; * -[Startup] - ; Place to create a PID file - ; If no path if specified then a PID file is not created. - ; PIDFile = "/tmp/Robust.exe.pid" - - ; Plugin Registry Location - ; Set path to directory for plugin registry. Information - ; about the registered repositories and installed plugins - ; will be stored here - ; The Robust.exe process must have R/W access to the location - RegistryLocation = "." - - ; Modular configurations - ; Set path to directory for modular ini files... - ; The Robust.exe process must have R/W access to the location - ConfigDirectory = "." - - console = "rest" - - ; Console commands can be saved to a file, so the command history persists after a restart. (default is true) - ConsoleHistoryFileEnabled = false - - ; The history file can be just a filename (relative to OpenSim's bin/ directory - ; or it can be a full path to somewhere else. (default is OpenSimConsoleHistory.txt in bin/) - ConsoleHistoryFile = "RobustConsoleHistory.txt" - - ; How many lines of command history should we keep? (default is 100) - ConsoleHistoryFileLines = 100 - -[ServiceList] - GridServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:GridServiceConnector" - PresenceServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:PresenceServiceConnector" - InstantMessageServerConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:InstantMessageServerConnector" - UserAccountServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:UserAccountServiceConnector" - InventoryInConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:XInventoryInConnector" - - ;; Uncomment as more tests are added - ;AssetServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:AssetServiceConnector" - ;GridInfoServerInConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:GridInfoServerInConnector" - ;AuthenticationServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:AuthenticationServiceConnector" - ;OpenIdServerConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:OpenIdServerConnector" - ;AvatarServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:AvatarServiceConnector" - ;LLLoginServiceInConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:LLLoginServiceInConnector" - ;GridUserServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:GridUserServiceConnector" - ;FriendsServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:FriendsServiceConnector" - ;MapAddServiceConnector = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:MapAddServiceConnector" - ;MapGetServiceConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:MapGetServiceConnector" - ;OfflineIMServiceConnector = "${Const|PrivatePort}/OpenSim.Addons.OfflineIM.dll:OfflineIMServiceRobustConnector" - ;GroupsServiceConnector = "${Const|PrivatePort}/OpenSim.Addons.Groups.dll:GroupsServiceRobustConnector" - ;BakedTextureService = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:XBakesConnector" - ;UserProfilesServiceConnector = "${Const|PublicPort}/OpenSim.Server.Handlers.dll:UserProfilesConnector" - ;EstateDataService = "${Const|PrivatePort}/OpenSim.Server.Handlers.dll:EstateDataRobustConnector" - -; * This is common for all services, it's the network setup for the entire -; * server instance, if none is specified above -; * -[Network] - port = ${Const|PrivatePort} - - ;; The follow 3 variables are for HTTP Basic Authentication for the Robust services. - ;; Use this if your central services in port ${Const|PrivatePort} need to be accessible on the Internet - ;; but you want to protect them from unauthorized access. - ; AuthType = "BasicHttpAuthentication" - ; HttpAuthUsername = "some_username" - ; HttpAuthPassword = "some_password" - ;; - ;; AuthType above can be overriden in any of the service sections below by - ; AuthType = "None" - ;; This is useful in cases where you want to protect most of the services, - ;; but unprotect individual services. Username and Password can also be - ;; overriden if you want to use different credentials for the different services. - - ;; By default, scripts are not allowed to call private services via llHttpRequest() - ;; Such calls are detected by the X-SecondLife-Shared HTTP header - ;; If you allow such calls you must be sure that they are restricted to very trusted scripters - ;; (remember scripts can also be in visiting avatar attachments). - ;; This can be overriden in individual private service sections if necessary - AllowllHTTPRequestIn = false - - ; * The following are for the remote console - ; * They have no effect for the local or basic console types - ; * Leave commented to diable logins to the console - ;ConsoleUser = Test - ;ConsolePass = secret - ;ConsolePort = 0 - - -[DatabaseService] - ; PGSQL - ; Uncomment these lines if you want to use PGSQL storage - ; Change the connection string to your db details - ;StorageProvider = "OpenSim.Data.PGSQL.dll" - ;ConnectionString = "Server=localhost;Database=opensim;User Id=opensim; password=***;" - - ; Null - ; Uncomment these lines if you want to use MySQL storage - ; Change the connection string to your db details - StorageProvider = "OpenSim.Data.Null.dll" - ConnectionString = "" - - -; * As an example, the below configuration precisely mimicks the legacy -; * asset server. It is read by the asset IN connector (defined above) -; * and it then loads the OUT connector (a local database module). That, -; * in turn, reads the asset loader and database connection information -; * -[AssetService] - LocalServiceModule = "OpenSim.Services.AssetService.dll:AssetService" - DefaultAssetLoader = "" - - ; Allow maptile assets to remotely deleted by remote calls to the asset service. - ; There is no harm in having this as false - it just means that historical maptile assets are not deleted. - ; This only applies to maptiles served via the version 1 viewer mechanisms - ; Default is false - AllowRemoteDelete = false - - ; Allow all assets to be remotely deleted. - ; Only set this to true if you are operating a grid where you control all calls to the asset service - ; (where a necessary condition is that you control all simulators) and you need this for admin purposes. - ; If set to true, AllowRemoteDelete = true is required as well. - ; Default is false. - AllowRemoteDeleteAllTypes = false - - -; * This configuration loads the inventory server modules. It duplicates -; * the function of the legacy inventory server -; * -[InventoryService] - LocalServiceModule = "OpenSim.Services.InventoryService.dll:XInventoryService" - - StorageProvider = "OpenSim.Tests.Common.dll:TestXInventoryDataPlugin" - ConnectionString = "" - - ; Will calls to purge folders (empty trash) and immediately delete/update items or folders (not move to trash first) succeed? - ; If this is set to false then some other arrangement must be made to perform these operations if necessary. - AllowDelete = true - - -; * This is the new style grid service. -; * "Realm" is the table that is used for user lookup. -; * It defaults to "regions", which uses the legacy tables -; * -[GridService] - LocalServiceModule = "OpenSim.Services.GridService.dll:GridService" - ; Realm = "regions" - ; AllowDuplicateNames = "True" - - ;; Next, we can specify properties of regions, including default and fallback regions - ;; The syntax is: Region_ = "" - ;; or: Region_ = "" - ;; where can be DefaultRegion, DefaultHGRegion, FallbackRegion, NoDirectLogin, Persistent, LockedOut, Reservation, NoMove, Authenticate - ;; - ;; DefaultRegion If a local login cannot be placed in the required region (e.g. home region does not exist, avatar is not allowed entry, etc.) - ;; then this region becomes the destination. Only the first online default region will be used. If no DefaultHGRegion - ;; is specified then this will also be used as the region for hypergrid connections that require it (commonly because they have not specified - ;; an explicit region. - ;; - ;; DefaultHGRegion If an avatar connecting via the hypergrid does not specify a region, then they are placed here. Only the first online - ;; region will be used. - ;; - ;; FallbackRegion If the DefaultRegion is not available for a local login, then any FallbackRegions are tried instead. These are tried in the - ;; order specified. This only applies to local logins at this time, not Hypergrid connections. - ;; - ;; NoDirectLogin A hypergrid user cannot directly connect to this region. This does not apply to local logins. - ;; - ;; Persistent When the simulator is shutdown, the region is signalled as offline but left registered on the grid. - ;; - ;; Example specification: - ; Region_Welcome_Area = "DefaultRegion, FallbackRegion" - ; (replace spaces with underscore) - - ;; Allow supporting viewers to export content - ;; Set to false to prevent export - ExportSupported = true - - - - -; * This is the new style authentication service. Currently, only MySQL -; * is implemented. -; * -[AuthenticationService] - ; for the server connector - LocalServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" - - ;; Allow the service to process HTTP getauthinfo calls. - ;; Default is false. - ; AllowGetAuthInfo = false - - ;; Allow the service to process HTTP setauthinfo calls. - ;; Default is false. - ; AllowSetAuthInfo = false - - ;; Allow the service to process HTTP setpassword calls. - ;; Default is false. - ; AllowSetPassword = false - - -; * This is the new style authentication service. Currently, only MySQL -; * is implemented. "Realm" is the table that is used for user lookup. -; * It defaults to "useraccounts", which uses the new style. -; * Realm = "users" will use the legacy tables as an authentication source -; * -[UserAccountService] - StorageProvider = "OpenSim.Data.Null.dll" - ConnectionString = "" - - ; for the server connector - LocalServiceModule = "OpenSim.Services.UserAccountService.dll:UserAccountService" - ; Realm = "useraccounts" - - ; These are for creating new accounts by the service - ;AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" - PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" - GridService = "OpenSim.Services.GridService.dll:GridService" - InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService" - ;AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService" - ;GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService" - - ;; This switch creates the minimum set of body parts and avatar entries for a viewer 2 - ;; to show a default "Ruth" avatar rather than a cloud for a newly created user. - ;; Default is false - CreateDefaultAvatarEntries = true - - ;; Allow the service to process HTTP createuser calls. - ;; Default is false. - AllowCreateUser = true - - ;; Allow the service to process HTTP setaccount calls. - ;; Default is false. - AllowSetAccount = true - - -[GridUserService] - ; for the server connector - LocalServiceModule = "OpenSim.Services.UserAccountService.dll:GridUserService" - - -[PresenceService] - ; for the server connector - LocalServiceModule = "OpenSim.Services.PresenceService.dll:PresenceService" - ; Set this to true to allow the use of advanced web services and multiple - ; bots using one account - AllowDuplicatePresences = false; - - -[AvatarService] - ; for the server connector - LocalServiceModule = "OpenSim.Services.AvatarService.dll:AvatarService" - - -[FriendsService] - ; for the server connector - LocalServiceModule = "OpenSim.Services.FriendsService.dll:FriendsService" - -[EstateService] - LocalServiceModule = "OpenSim.Services.EstateService.dll:EstateDataService" - -[LibraryService] - LibraryName = "OpenSim Library" - DefaultLibrary = "./inventory/Libraries.xml" - - -[LoginService] - ; for the server connector - LocalServiceModule = "OpenSim.Services.LLLoginService.dll:LLLoginService" - ; for the service - UserAccountService = "OpenSim.Services.UserAccountService.dll:UserAccountService" - GridUserService = "OpenSim.Services.UserAccountService.dll:GridUserService" - AuthenticationService = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" - InventoryService = "OpenSim.Services.InventoryService.dll:XInventoryService" - AvatarService = "OpenSim.Services.AvatarService.dll:AvatarService" - PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" - GridService = "OpenSim.Services.GridService.dll:GridService" - SimulationService ="OpenSim.Services.Connectors.dll:SimulationServiceConnector" - LibraryService = "OpenSim.Services.InventoryService.dll:LibraryService" - FriendsService = "OpenSim.Services.FriendsService.dll:FriendsService" - - ; The minimum user level required for a user to be able to login. 0 by default - ; If you disable a particular user's account then you can set their login level below this number. - ; You can also change this level from the console though these changes will not be persisted. - ; MinLoginLevel = 0 - - ; Ask co-operative viewers to use a different currency name - ;Currency = "" - - ;; Set minimum fee to publish classified - ; ClassifiedFee = 0 - - WelcomeMessage = "Welcome, Avatar!" - AllowRemoteSetLoginLevel = "false" - - ; For V2 map - MapTileURL = "${Const|BaseURL}:${Const|PublicPort}/"; - - ; Url to search service - ; SearchURL = "${Const|BaseURL}:${Const|PublicPort}/"; - - ; For V3 destination guide - ; DestinationGuide = "${Const|BaseURL}/guide" - - ; For V3 avatar picker (( work in progress )) - ; AvatarPicker = "${Const|BaseURL}/avatars" - - ; If you run this login server behind a proxy, set this to true - ; HasProxy = false - - ;; Regular expressions for controlling which client versions are accepted/denied. - ;; An empty string means nothing is checked. - ;; - ;; Example 1: allow only these 3 types of clients (any version of them) - ;; AllowedClients = "Imprudence|Hippo|Second Life" - ;; - ;; Example 2: allow all clients except these - ;; DeniedClients = "Twisted|Crawler|Cryolife|FuckLife|StreetLife|GreenLife|AntiLife|KORE-Phaze|Synlyfe|Purple Second Life|SecondLi |Emerald" - ;; - ;; Note that these are regular expressions, so every character counts. - ;; Also note that this is very weak security and should not be trusted as a reliable means - ;; for keeping bad clients out; modified clients can fake their identifiers. - ;; - ;; - ;AllowedClients = "" - ;DeniedClients = "" - - ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" - ;; Viewers do not listen to timezone sent by the server. They use Pacific Standard Time instead, - ;; but rely on the server to calculate Daylight Saving Time. Sending another DST than US Pacific - ;; would result in time inconsistencies between grids (during summer and around DST transition period) - ;; default let OpenSim calculate US Pacific DST - ;; "none" disable DST (equivallent to "local" with system set to GMT) - ;; "local" force legacy behaviour (using local system time to calculate DST) - ; DSTZone = "America/Los_Angeles;Pacific Standard Time" - - ;# {DSTZone} {} {Override Daylight Saving Time rules} {* none local} "America/Los_Angeles;Pacific Standard Time" - ;; Viewers do not receive timezone information from the server - almost all (?) default to Pacific Standard Time - ;; However, they do rely on the server to tell them whether it's Daylight Saving Time or not. - ;; Hence, calculating DST based on a different timezone can result in a misleading viewer display and inconsistencies between grids. - ;; By default, this setting uses various timezone names to calculate DST with regards to the viewer's standard PST. - ;; Options are - ;; "none" no DST - ;; "local" use the server's only timezone to calculate DST. This is previous OpenSimulator behaviour. - ;; "America/Los_Angeles;Pacific Standard Time" use these timezone names to look up Daylight savings. - ;; 'America/Los_Angeles' is used on Linux/Mac systems whilst 'Pacific Standard Time' is used on Windows - DSTZone = "America/Los_Angeles;Pacific Standard Time" - - ;Basic Login Service Dos Protection Tweaks - ;; - ;; Some Grids/Users use a transparent proxy that makes use of the X-Forwarded-For HTTP Header, If you do, set this to true - ;; If you set this to true and you don't have a transparent proxy, it may allow attackers to put random things in the X-Forwarded-For header to - ;; get around this basic DOS protection. - ;DOSAllowXForwardedForHeader = false - ;; - ;; The protector adds up requests during this rolling period of time, default 10 seconds - ;DOSRequestTimeFrameMS = 10000 - ;; - ;; The amount of requests in the above timeframe from the same endpoint that triggers protection - ;DOSMaxRequestsInTimeFrame = 5 - ;; - ;; The amount of time that a specific endpoint is blocked. Default 2 minutes. - ;DOSForgiveClientAfterMS = 120000 - ;; - ;; To turn off basic dos protection, set the DOSMaxRequestsInTimeFrame to 0. - - -[MapImageService] - LocalServiceModule = "OpenSim.Services.MapImageService.dll:MapImageService" - - ; Set this if you want to change the default - ; TilesStoragePath = "maptiles" - ; - ; If for some reason you have the AddMapTile service outside the firewall (e.g. ${Const|PublicPort}), - ; you may want to set this. Otherwise, don't set it, because it's already protected. - ; GridService = "OpenSim.Services.GridService.dll:GridService" - ; - ; Additionally, if you run this server behind a proxy, set this to true - ; HasProxy = false - - -[Messaging] - ; OfflineIM - OfflineIMService = "" - - -[GridInfoService] - ; These settings are used to return information on a get_grid_info call. - ; Client launcher scripts and third-party clients make use of this to - ; autoconfigure the client and to provide a nice user experience. If you - ; want to facilitate that, you should configure the settings here according - ; to your grid or standalone setup. - ; - ; See http://opensimulator.org/wiki/GridInfo - - ; login uri: for grid this is the login server URI - login = ${Const|BaseURL}:${Const|PublicPort}/ - - ; long grid name: the long name of your grid - gridname = "the lost continent of hippo" - - ; short grid name: the short name of your grid - gridnick = "hippogrid" - - ; login page: optional: if it exists it will be used to tell the client to use - ; this as splash page - ;welcome = ${Const|BaseURL}/welcome - - ; helper uri: optional: if it exists if will be used to tell the client to use - ; this for all economy related things - ;economy = ${Const|BaseURL}:${Const|PublicPort}/ - - ; web page of grid: optional: page providing further information about your grid - ;about = ${Const|BaseURL}/about/ - - ; account creation: optional: page providing further information about obtaining - ; a user account on your grid - ;register = ${Const|BaseURL}/register - - ; help: optional: page providing further assistance for users of your grid - ;help = ${Const|BaseURL}/help - - ; password help: optional: page providing password assistance for users of your grid - ;password = ${Const|BaseURL}/password - - -[UserProfilesService] - LocalServiceModule = "OpenSim.Services.UserProfilesService.dll:UserProfilesService" - Enabled = false - ;; Configure this for separate profiles database - ;; ConnectionString = "Data Source=localhost;Database=opensim;User ID=opensim;Password=*****;Old Guids=true;" - ;; Realm = UserProfiles - UserAccountService = OpenSim.Services.UserAccountService.dll:UserAccountService - AuthenticationServiceModule = "OpenSim.Services.AuthenticationService.dll:PasswordAuthenticationService" - - -[BakedTextureService] - LocalServiceModule = "OpenSim.Server.Handlers.dll:XBakes" - ;; This directory must be writable by the user ROBUST runs as. It will be created automatically. - BaseDirectory = "./bakes" - -[HGInstantMessageService] - LocalServiceModule = "OpenSim.Services.HypergridService.dll:HGInstantMessageService" - GridService = "OpenSim.Services.GridService.dll:GridService" - PresenceService = "OpenSim.Services.PresenceService.dll:PresenceService" - UserAgentService = "" - ; This should always be true in the Robust config - InGatekeeper = True diff --git a/config/config.ini b/config/config.ini index f60c7af..31ce07f 100644 --- a/config/config.ini +++ b/config/config.ini @@ -37,5 +37,5 @@ DataProvider = "OpenSim.Data.MySQL.dll" - ConnectionString = "Data Source=localhost;Database=$MYSQL_DB;User ID=$MYSQL_USER;Password=$MYSQL_PASSWORD;Old Guids=true;" + ConnectionString = "Data Source=MYSQL_HOST;Database=MYSQL_DB;User ID=MYSQL_USER;Password=MYSQL_PASSWORD;Old Guids=true;" diff --git a/config/sim01/My_sim.xml b/config/sim01/My_sim.xml new file mode 100644 index 0000000..144cb0a --- /dev/null +++ b/config/sim01/My_sim.xml @@ -0,0 +1,11 @@ + +
+ + + + + + + +
+
diff --git a/config/sim01/ThisSim.ini b/config/sim01/ThisSim.ini new file mode 100644 index 0000000..e7953ab --- /dev/null +++ b/config/sim01/ThisSim.ini @@ -0,0 +1,6 @@ +[Startup] + PIDFile = "/var/run/opensim/sim01.pid" + regionload_regionsdir="/opt/opensim/config/sim01" + +[Network] + http_listener_port = 9105 diff --git a/config/sim01/opensim-monit.conf b/config/sim01/opensim-monit.conf new file mode 100644 index 0000000..9d66ce6 --- /dev/null +++ b/config/sim01/opensim-monit.conf @@ -0,0 +1,29 @@ +# manage the OpenSim process for Your Sim +# +# usage: +# monit start your_sim +# monit stop your_sim +# monit restart your_sim +# +# see 'daemon' setting in /etc/monit/monitrc for the cycle length. +# on ubuntu/debian, this is overridden by the CHECK_INTERVALS var in +# /etc/default/monit . the below assumes you've set it to 30 seconds. +# +# see ../README for configuration instructions. +# +# Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. +# +check process sim01 with pidfile /var/run/opensim/sim01.pid + start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/sim01 && /opt/opensim/config/sim01/start-sim -q'" + as uid root and gid root + stop program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/sim01 && /opt/opensim/config/sim01/stop-sim'" with timeout 600 seconds + if cpu usage > 50% for 4 cycles then restart + if MEMORY usage > 25% for 4 cycles then restart +# if 5 restarts within 5 cycles then timeout +# if failed url http://127.0.0.1:9005/jsonSimStats/ +# and content != '"SimFPS":0.0,' for 4 cycles +# then restart +# if failed url http://127.0.0.1:9008/jsonSimStats/ +# and content == '"SimFPS":' for 4 cycles +# then restart + depends on ROBUST -- cgit v1.1