DieTanx Posted April 23, 2017 Report Share Posted April 23, 2017 Hello, i am looking for somebody to possibly share clean up scripts beyond the stock scripts that come with the epoch now. I would like to reduce the size of my database, its getting quite large and is starting to lag server the more it grows. Please and thank you. Link to comment Share on other sites More sharing options...
0 Relentless Posted May 17, 2017 Report Share Posted May 17, 2017 46 minutes ago, DieTanx said: Question, Trying to run clean up script from bec- no errors, Scheduler working, restart messages, but i dont see this running/cleanup of database happening Any thoughts? Or would this be better as a Fire Dameon or windows service? Run this for multiple servers- So assumed bec would be best option. but i may be wrong. <job id="0"> <time>001500</time> <delay>000000</delay> <day>1,2,3,4,5,6,7</day> <start>013000</start> <runtime>020000</runtime> <loop>0</loop> <cmd>D:\Games\overpoch106\BEC\Config\db_cleanup.bat</cmd> <cmdtype>1</cmdtype> </job> How do you know this isn't working? A cleanup is fast as hell and you are maybe not able to see the prompt window during that short time period. I suggest instead of exit for the last line in your db_cleanup.bat you write PAUSE to see whether this window is opening. It will stay open with that until you hit a key. Link to comment Share on other sites More sharing options...
0 DieTanx Posted May 17, 2017 Author Report Share Posted May 17, 2017 6 minutes ago, DAmNRelentless said: How do you know this isn't working? A cleanup is fast as hell and you are maybe not able to see the prompt window during that short time period. I suggest instead of exit for the last line in your db_cleanup.bat you write PAUSE to see whether this window is opening. It will stay open with that until you hit a key. This should delete all within 1 day- i had stuff over 4 days old(last tiime i manually run it) -- ---------------------------- -- Delete player login data. -- ---------------------------- DELETE FROM `player_login` WHERE `Datestamp` <= date_sub(CURRENT_TIMESTAMP, INTERVAL 1 DAY) -- ---------------------------- deleted 255 vehicles when run manually after 2 resets today I HIGHLY doubt 255 vehicles waited until today to time out- -- Delete all vehicles not touched in 5 days. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY) AND `Classname` NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara'; -- ---------------------------- Link to comment Share on other sites More sharing options...
0 DieTanx Posted May 18, 2017 Author Report Share Posted May 18, 2017 https://pastebin.com/PwAZAmNW Here is my batch- Where am i going wrong? Link to comment Share on other sites More sharing options...
0 Relentless Posted May 18, 2017 Report Share Posted May 18, 2017 11 minutes ago, DieTanx said: https://pastebin.com/PwAZAmNW Here is my batch- Where am i going wrong? Why is the sql code in that batch file? Link to comment Share on other sites More sharing options...
0 BigEgg Posted May 18, 2017 Report Share Posted May 18, 2017 1 hour ago, DieTanx said: https://pastebin.com/PwAZAmNW Here is my batch- Where am i going wrong? Create a batch file somewhere on your server with this code in it: @echo off :: Database Table Name (default is dayz_epoch) set mysqlschema=dayz_epoch :: Username to access the database set mysqlpassword=root :: Password to access the database set mysqluser=password :: Path to mysql.exe file (default) set mysqlpath="C:\Program Files\MySQL\MySQL Server 5.7\bin" :: Path to cleanup script file (the file with all of the cleanup code in it) set mysqlcleanup="C:\PATH HERE\PATH.sql" %mysqlpath% -u %mysqluser% -p%mysqlpassword% %mysqlschema% < %mysqlcleanup% exit Then, on your server, create an sql file and add the following to it: -- -------------------------------------------------------------------------------- -- --------------------------------Base Maintenance-------------------------------- -- -------------------------------------------------------------------------------- -- ---------------------------- -- Fix inventory on maintainable objects. -- ---------------------------- UPDATE `object_data` SET `inventory` = '[]',`LastUpdated` = `LastUpdated` WHERE `inventory` = '[[[],[]],[[],[]],[[],[]]]' AND `Classname` IN ('BagFenceRound_DZ','CinderWall_DZ','CinderWallDoorLocked_DZ','CinderWallDoorSmall_DZ','CinderWallDoorSmallLocked_DZ','CinderWallHalf_DZ','FireBarrel_DZ','GunRack_DZ','LightPole_DZ','MetalFloor_DZ','MetalPanel_DZ','OutHouse_DZ','TentStorage','TentStorageDomed','TentStorageDomed2','Sandbag1_DZ','Scaffolding_DZ','StickFence_DZ','StorageShed_DZ','WorkBench_DZ','WoodCrate_DZ','WoodFloor_DZ','WoodFloorQuarter_DZ','WoodLargeWall_DZ','WoodLargeWallWin_DZ','WoodShack_DZ','WoodSmallWall_DZ','WoodSmallWallThird_DZ','WoodSmallWallWin_DZ','Land_DZE_GarageWoodDoor','WoodFloorHalf_DZ','Fort_RazorWire','Land_DZE_LargeWoodDoorLocked','WoodStairsRails_DZ','WoodLadder_DZ','WoodStairsSans_DZ','M240Nest_DZ','Land_DZE_WoodDoor'); -- ---------------------------- -- Set 0.1 damage to objects daily. -- ---------------------------- UPDATE `object_data` SET `Damage` = IF( `Damage` = 0.0, 0.1, `Damage` + 0.1 ) WHERE `LastUpdated` <= DATE_SUB(NOW(), INTERVAL 1 DAY) AND `ObjectUID` <> 0 AND `CharacterID` <> 0 AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') ); -- ---------------------------- -- Set 0.1 damage doors/plots daily. -- ---------------------------- UPDATE `object_data` SET `Damage` = IF( `Damage` = 0.0, 0.1, `Damage` + 0.1 ) WHERE `Classname` IN ('Plastic_Pole_EP1_DZ','CinderWallDoorSmallLocked_DZ','CinderWallDoorLocked_DZ','CinderWallSmallDoorway_DZ','CinderWallDoorway_DZ','Land_DZE_WoodDoorLocked','CinderWallDoor_DZ','CinderWallDoorSmall_DZ','Land_DZE_WoodDoor','Land_DZE_GarageWoodDoor','Land_DZE_GarageWoodDoorLocked','Land_DZE_LargeWoodDoorLocked','Land_DZE_LargeWoodDoor','WoodLargeWallDoor_DZ') AND `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 DAY) AND `Inventory` != '[]'; -- ---------------------------- -- Set safe combinations to 0000 after 10 days of inactivity. -- ---------------------------- UPDATE `object_data` SET `CharacterID` = 0 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND `CharacterID` > 0 AND `Classname` = "VaultStorageLocked" AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL; -- ---------------------------- -- Set lockbox combinations to RED00 after 10 days of inactivity. -- ---------------------------- UPDATE `object_data` SET `CharacterID` = 10000 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND `CharacterID` > 0 AND `Classname` = "LockboxStorageLocked" AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL; -- ---------------------------- -- Delete empty storage objects. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY) AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') OR (`Inventory` = '[[[],[]],[[],[]],[[],[]]]') ) AND `Classname` IN ('Wooden_shed_DZ','WoodShack_DZ', 'TentStorage', 'TentStorageDomed', 'TentStorageDomed2', 'WoodCrate_DZ', 'GunRack_DZ', 'OutHouse_DZ', 'StorageShed_DZ'); -- ---------------------------- -- Delete inactive storage objects. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND `Classname` IN ('Wooden_shed_DZ','WoodShack_DZ', 'TentStorage', 'TentStorageDomed', 'TentStorageDomed2', 'WoodCrate_DZ', 'GunRack_DZ', 'OutHouse_DZ', 'StorageShed_DZ'); -- ---------------------------- -- Delete objects that have 1 damage. -- ---------------------------- DELETE FROM `object_data` WHERE Damage = 1; -- ---------------------------- -- Delete plot poles and doors not being deleted. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 11 DAY) AND `Classname` IN ('Plastic_Pole_EP1_DZ','CinderWallDoorSmallLocked_DZ','CinderWallDoorLocked_DZ','CinderWallSmallDoorway_DZ','CinderWallDoorway_DZ','Land_DZE_WoodDoorLocked','CinderWallDoor_DZ','CinderWallDoorSmall_DZ','Land_DZE_WoodDoor','Land_DZE_GarageWoodDoor','Land_DZE_GarageWoodDoorLocked','Land_DZE_LargeWoodDoorLocked','Land_DZE_LargeWoodDoor','WoodLargeWallDoor_DZ'); -- ---------------------------- -- Delete old stuff. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 21 DAY); -- -------------------------------------------------------------------------------- -- ------------------------------Vehicle Maintenance------------------------------- -- -------------------------------------------------------------------------------- -- ---------------------------- -- Delete Bikes, ATV's, Mozzie's, 350z's, and Busses. -- ---------------------------- DELETE FROM `object_data` WHERE `Classname` IN ('MMT_Civ','Old_bike_TK_INS_EP1','TT650_Civ','TT650_Ins','Old_moto_TK_Civ_EP1','M1030_US_DES_EP1','TT650_TK_CIV_EP1','ATV_CZ_EP1','ATV_US_EP1','CSJ_GyroC','350z','350z_red','350z_kiwi','350z_black','350z_silver','350z_green','350z_blue','350z_gold','350z_white','350z_pink','350z_mod','350z_ruben','350z_v','350z_city','350z_yellow','Ikarus','Ikarus_TK_CIV_EP1'); -- ---------------------------- -- Delete useless vehicles with no keys. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 4 HOUR) AND `CharacterID` = '0' AND `Classname` IN ('AN2_DZ','GNT_C185U','GNT_C185','GNT_C185R','GNT_C185C','RHIB','Smallboat_1','Smallboat_2','Zodiac','Fishing_Boat','PBX','JetSkiYanahui_Case_Red','JetSkiYanahui_Case_Yellow','JetSkiYanahui_Case_Green','JetSkiYanahui_Case_Blue','CSJ_GyroP','CSJ_GyroCover','LandRover_CZ_EP1','LandRover_TK_CIV_EP1','HMMWV_M1035_DES_EP1','HMMWV_Ambulance','HMMWV_Ambulance_CZ_DES_EP1','HMMWV_DZ','HMMWV_DES_EP1','Civcar','Civcarbu','civcarbl','Civcarre','Civcarge','Civcarwh','Civcarsl','hilux1_civil_3_open_EP1','datsun1_civil_3_open_DZE','hilux1_civil_1_open_DZE','datsun1_civil_2_covered_DZE','datsun1_civil_1_open_DZE','hilux1_civil_2_covered_DZE','Skoda','SkodaBlue','SkodaGreen','SkodaRed','VolhaLimo_TK_CIV_EP1','Volha_1_TK_CIV_EP1','Volha_2_TK_CIV_EP1','VWGolf','car_hatchback','car_sedan','GLT_M300_LT','GLT_M300_ST','Lada1','Lada1_TK_CIV_EP1','Lada2','Lada2_TK_CIV_EP1','LadaLM','SUV_TK_CIV_EP1','SUV_Blue','SUV_Charcoal','SUV_Green','SUV_Orange','SUV_Pink','SUV_Red','SUV_Silver','SUV_White','SUV_Yellow','SUV_Camo','UAZ_CDF','UAZ_INS','UAZ_RU','UAZ_Unarmed_TK_CIV_EP1','UAZ_Unarmed_TK_EP1','UAZ_Unarmed_UN_EP1'); -- ---------------------------- -- Delete useless vehicles with keys. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY) AND `CharacterID` > 0 AND `Classname` IN ('AN2_DZ','GNT_C185U','GNT_C185','GNT_C185R','GNT_C185C','RHIB','Smallboat_1','Smallboat_2','Zodiac','Fishing_Boat','PBX','JetSkiYanahui_Case_Red','JetSkiYanahui_Case_Yellow','JetSkiYanahui_Case_Green','JetSkiYanahui_Case_Blue','CSJ_GyroP','CSJ_GyroCover','LandRover_CZ_EP1','LandRover_TK_CIV_EP1','HMMWV_M1035_DES_EP1','HMMWV_Ambulance','HMMWV_Ambulance_CZ_DES_EP1','HMMWV_DZ','HMMWV_DES_EP1','Civcar','Civcarbu','civcarbl','Civcarre','Civcarge','Civcarwh','Civcarsl','hilux1_civil_3_open_EP1','datsun1_civil_3_open_DZE','hilux1_civil_1_open_DZE','datsun1_civil_2_covered_DZE','datsun1_civil_1_open_DZE','hilux1_civil_2_covered_DZE','Skoda','SkodaBlue','SkodaGreen','SkodaRed','VolhaLimo_TK_CIV_EP1','Volha_1_TK_CIV_EP1','Volha_2_TK_CIV_EP1','VWGolf','car_hatchback','car_sedan','GLT_M300_LT','GLT_M300_ST','Lada1','Lada1_TK_CIV_EP1','Lada2','Lada2_TK_CIV_EP1','LadaLM','SUV_TK_CIV_EP1','SUV_Blue','SUV_Charcoal','SUV_Green','SUV_Orange','SUV_Pink','SUV_Red','SUV_Silver','SUV_White','SUV_Yellow','SUV_Camo','UAZ_CDF','UAZ_INS','UAZ_RU','UAZ_Unarmed_TK_CIV_EP1','UAZ_Unarmed_TK_EP1','UAZ_Unarmed_UN_EP1'); -- ---------------------------- -- Delete server spawned vehicles. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY) AND `CharacterID` = '0' AND `Classname` NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara'; -- ---------------------------- -- Delete all vehicles not touched in 10 days. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND `Classname` NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara'; -- ---------------------------- -- Unlock purchased, inactive vehicles. -- ---------------------------- UPDATE `object_data` SET `CharacterID` = 0,`LastUpdated` = `LastUpdated` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 7 DAY) AND `CharacterID` > 0 AND `Classname` NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara'; -- ---------------------------- -- Unlock vehicle's with no key. -- ---------------------------- UPDATE `Object_DATA` SET `Object_DATA`.`CharacterID` = 0,`LastUpdated` = `LastUpdated` WHERE `Object_DATA`.`CharacterID` <> 0 AND`Object_DATA`.`CharacterID` <= 12500 AND`Object_DATA`.`Classname` NOT LIKE 'Tent%' AND`Object_DATA`.`Classname` NOT LIKE '%Locked' AND`Object_DATA`.`Classname` NOT LIKE 'Land%' AND`Object_DATA`.`Classname` NOT LIKE 'Cinder%' AND`Object_DATA`.`Classname` NOT LIKE 'Wood%' AND`Object_DATA`.`Classname` NOT LIKE 'Metal%' AND`Object_DATA`.`Classname` NOT LIKE '%Storage%' AND`Object_DATA`.`Classname` NOT IN ('OutHouse_DZ', 'GunRack_DZ', 'WorkBench_DZ', 'Sandbag1_DZ', 'FireBarrel_DZ', 'DesertCamoNet_DZ', 'StickFence_DZ', 'LightPole_DZ', 'DeerStand_DZ', 'ForestLargeCamoNet_DZ', 'Plastic_Pole_EP1_DZ', 'Hedgehog_DZ', 'FuelPump_DZ', 'Fort_RazorWire', 'SandNest_DZ', 'ForestCamoNet_DZ', 'Fence_corrugated_DZ', 'CanvasHut_DZ', 'Generator_DZ') AND FindVehicleKeysCount(Object_DATA.CharacterID) = 0; -- -------------------------------------------------------------------------------- -- -------------------------------Player Maintenance------------------------------- -- -------------------------------------------------------------------------------- -- ---------------------------- -- Delete player login data. -- ---------------------------- DELETE FROM `player_login`; -- ---------------------------- -- Delete dead characters. -- ---------------------------- DELETE from Character_data USING Character_data, Character_data as tempchartable WHERE (Character_data.PlayerUID = tempchartable.PlayerUID) AND (NOT Character_data.alive = tempchartable.alive) AND (Character_data.alive = 0); -- ---------------------------- -- Delete characters inactive for 30 days. -- ---------------------------- DELETE FROM Character_DATA WHERE LastLogin < NOW() - INTERVAL 30 DAY; Then, add this line above where the server is started in your restart batch file (obviously adjust the path): start /wait "C:\FIle Path\SQLBATCHFILE.bat" Once you have done that, adjust the information in the batch file to match your server. The mysqlcleanup path is the path to the sql file that you created. Example: C:\Users\root\Desktop\SQLFILE.sql DieTanx and theduke 2 Link to comment Share on other sites More sharing options...
0 DieTanx Posted May 18, 2017 Author Report Share Posted May 18, 2017 I added a pause since i wasnt getting results- intended added a \ after bin so it found the correct folder also added mysql.exe to the mysqlpath I am a complete noob with batch files, so all help you have given so far is GREATLY appreciated! Link to comment Share on other sites More sharing options...
0 BigEgg Posted May 18, 2017 Report Share Posted May 18, 2017 11 minutes ago, DieTanx said: i kept the default mysql server info- but getting this error Thoughts? :: Path to mysql.exe file (default) set mysqlpath="C:\Program Files\MySQL\MySQL Server 5.7\bin" Apologies, I forgot the executable part lol - typing too fast Try this instead of that path: "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" DieTanx 1 Link to comment Share on other sites More sharing options...
0 DieTanx Posted May 18, 2017 Author Report Share Posted May 18, 2017 6 minutes ago, BigEgg said: Apologies, I forgot the executable part lol - typing too fast Try this instead of that path: "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" Smexy! now working! Thank you to all whom helped! You guys are amazing! BigEgg 1 Link to comment Share on other sites More sharing options...
0 juandayz Posted June 10, 2017 Report Share Posted June 10, 2017 this is the way that works for me with xamp.. (the bat from above dsnt works for me). START MY SERVER WITH: LAUNCHER.BAT Spoiler @echo off ::CONFIG SETTINGS set becPath="D:\epoch16" set serverPath="D:\epoch16" set DB_USERNAME="your user" set DB_PASSWORD="your pass" set DB_NAME="your db" ::END SETTINGS :arma2oaserver echo MONITOR STARTING... FOR /F "tokens=1-4 DELIMS=/ " %%F IN ('date /T') DO (set v_date=%%F%%G%%H) FOR /F "tokens=1-4 DELIMS=: " %%F IN ('time /T') DO (set v_time=%%F%%G%%H) set fname=database_%v_date%_%v_time%.sql ping 127.0.0.1 -n 5 >NUL title SERVER NAME cd %becPath% echo (%time%) LOADING BEC. start "BEC_CONTROL" "BEC_CONTROL.bat" cd %serverPath% echo (%time%) SERVER STARTING. start /wait "arma2" /min "D:\epoch16\arma2oaserver.exe" -port=2302 -autoInit -noSound -noPause "-config=instance_2_utes\config.cfg" "-cfg=instance_2_utes\basic.cfg" "-profiles=instance_2_utes" -name=instance_2_utes "-mod=@DayZ_Epoch;@DayZ_Epoch_Server;" echo (%time%) WARNING: AUTORESTART IS ACTIVE NOW goto arma2oaserver BEC_CONTROL.bat Spoiler TIMEOUT /T 25 /NOBREAK cd\ cd "D:\epoch16\instance_2_utes\BattlEye\Bec" Bec.exe -f Config.cfg --dsc in my scheduler.xml Spoiler <?xml version="1.0"?> <Scheduler> <!-- 12:00 AM restart --> <job id="0"> <time>23:59:00</time> <delay>000000</delay> <day>1,2,3,4,5,6,7</day> <loop>0</loop> <cmd>say -1 This server will restart in 1 minute, Log out now!</cmd> <cmdtype>0</cmdtype> </job> <job id="1"> <time>00:00:00</time> <delay>000000</delay> <day>1,2,3,4,5,6,7</day> <loop>0</loop> <cmd>#shutdown</cmd> <cmdtype>0</cmdtype> </job> <job id="2"> <time>00:00:01</time> <delay>000000</delay> <day>1,2,3,4,5,6,7</day> <loop>0</loop> <cmd>D:\epoch16\SHUTDOWN.bat</cmd> <cmdtype>1</cmdtype> </job> //THE REST OF THE JOBS BELOW SHUTDOWN.BAT Spoiler @echo off echo SHUTDOWN ARMA2OA SERVER TIMEOUT /T 2 /NOBREAK taskkill /F /IM arma2oaserver.exe TIMEOUT /T 4 /NOBREAK echo SHUTDOWN DEAD BEC taskkill /f /im cmd.exe /fi "windowtitle eq BEC_CONTROL echo LOADING CLEAN UP FUNCTIONS set cleanupfunction="D:\epoch16" cd /d %cleanupfunction% start "" "CLEANUP.bat" echo SUCCESS timeout 3 exit CLEANUP.BAT Spoiler @echo off set MYSQLHOST=127.0.0.1 :: Database Table Name set mysqlschema= your db :: Username to access the database set mysqlpassword= your pass :: Password to access the database set mysqluser= your user :: Path to mysql.exe file (default) set mysqlpath=C:\xampp\mysql\bin\ :: Path to cleanup script file (the file with all of the cleanup code in it) set mysqlcleanup="D:\Epoch16\SERVER_MAINTAIN.sql" "%mysqlpath%\mysql.exe" -h %MYSQLHOST% --user=%mysqluser% --password=%mysqlpassword% --database=%mysqlschema% < %mysqlcleanup% ::add PAUSE below if u wanna see what happend exit SERVER_MAINTAIN.sql (i use a lil modify of the one by bigegg and i think @BigEgg yours need add the function to find vehicles without key.. otherway drops an error with this line (AND FindVehicleKeysCount(Object_DATA.CharacterID) = 0;) Spoiler -- ---------------------------- -- Unlock vehicle's with no key. -- ---------------------------- UPDATE `Object_DATA` SET `Object_DATA`.`CharacterID` = 0,`LastUpdated` = `LastUpdated` WHERE `Object_DATA`.`CharacterID` <> 0 AND`Object_DATA`.`CharacterID` <= 12500 AND`Object_DATA`.`Classname` NOT LIKE 'Tent%' AND`Object_DATA`.`Classname` NOT LIKE '%Locked' AND`Object_DATA`.`Classname` NOT LIKE 'Land%' AND`Object_DATA`.`Classname` NOT LIKE 'Cinder%' AND`Object_DATA`.`Classname` NOT LIKE 'Wood%' AND`Object_DATA`.`Classname` NOT LIKE 'Metal%' AND`Object_DATA`.`Classname` NOT LIKE '%Storage%' AND`Object_DATA`.`Classname` NOT IN ('OutHouse_DZ', 'GunRack_DZ', 'WorkBench_DZ', 'Sandbag1_DZ', 'FireBarrel_DZ', 'DesertCamoNet_DZ', 'StickFence_DZ', 'LightPole_DZ', 'DeerStand_DZ', 'ForestLargeCamoNet_DZ', 'Plastic_Pole_EP1_DZ', 'Hedgehog_DZ', 'FuelPump_DZ', 'Fort_RazorWire', 'SandNest_DZ', 'ForestCamoNet_DZ', 'Fence_corrugated_DZ', 'CanvasHut_DZ', 'Generator_DZ') AND FindVehicleKeysCount(Object_DATA.CharacterID) = 0; BigEgg 1 Link to comment Share on other sites More sharing options...
0 BigEgg Posted June 10, 2017 Report Share Posted June 10, 2017 2 minutes ago, juandayz said: this is the way that works for me with xamp.. (the bat from above dsnt works for me). START MY SERVER WITH: LAUNCHER.BAT Hide contents @echo off ::CONFIG SETTINGS set becPath="D:\epoch16" set serverPath="D:\epoch16" set DB_USERNAME="your user" set DB_PASSWORD="your pass" set DB_NAME="your db" ::END SETTINGS :arma2oaserver echo MONITOR STARTING... FOR /F "tokens=1-4 DELIMS=/ " %%F IN ('date /T') DO (set v_date=%%F%%G%%H) FOR /F "tokens=1-4 DELIMS=: " %%F IN ('time /T') DO (set v_time=%%F%%G%%H) set fname=database_%v_date%_%v_time%.sql ping 127.0.0.1 -n 5 >NUL title SERVER NAME cd %becPath% echo (%time%) LOADING BEC. start "BEC_CONTROL" "BEC_CONTROL.bat" cd %serverPath% echo (%time%) SERVER STARTING. start /wait "arma2" /min "D:\epoch16\arma2oaserver.exe" -port=2302 -autoInit -noSound -noPause "-config=instance_2_utes\config.cfg" "-cfg=instance_2_utes\basic.cfg" "-profiles=instance_2_utes" -name=instance_2_utes "-mod=@DayZ_Epoch;@DayZ_Epoch_Server;" echo (%time%) WARNING: AUTORESTART IS ACTIVE NOW goto arma2oaserver BEC_CONTROL.bat Reveal hidden contents TIMEOUT /T 25 /NOBREAK cd\ cd "D:\epoch16\instance_2_utes\BattlEye\Bec" Bec.exe -f Config.cfg --dsc in my scheduler.xml Reveal hidden contents <?xml version="1.0"?> <Scheduler> <!-- 12:00 AM restart --> <job id="0"> <time>23:59:00</time> <delay>000000</delay> <day>1,2,3,4,5,6,7</day> <loop>0</loop> <cmd>say -1 This server will restart in 1 minute, Log out now!</cmd> <cmdtype>0</cmdtype> </job> <job id="1"> <time>00:00:00</time> <delay>000000</delay> <day>1,2,3,4,5,6,7</day> <loop>0</loop> <cmd>#shutdown</cmd> <cmdtype>0</cmdtype> </job> <job id="2"> <time>00:00:01</time> <delay>000000</delay> <day>1,2,3,4,5,6,7</day> <loop>0</loop> <cmd>D:\epoch16\SHUTDOWN.bat</cmd> <cmdtype>1</cmdtype> </job> //THE REST OF THE JOBS BELOW SHUTDOWN.BAT Reveal hidden contents @echo off echo SHUTDOWN ARMA2OA SERVER TIMEOUT /T 2 /NOBREAK taskkill /F /IM arma2oaserver.exe TIMEOUT /T 4 /NOBREAK echo SHUTDOWN DEAD BEC taskkill /f /im cmd.exe /fi "windowtitle eq BEC_CONTROL echo LOADING CLEAN UP FUNCTIONS set cleanupfunction="D:\epoch16" cd /d %cleanupfunction% start "" "CLEANUP.bat" echo SUCCESS timeout 3 exit CLEANUP.BAT Hide contents @echo off set MYSQLHOST=127.0.0.1 :: Database Table Name set mysqlschema= your db :: Username to access the database set mysqlpassword= your pass :: Password to access the database set mysqluser= your user :: Path to mysql.exe file (default) set mysqlpath=C:\xampp\mysql\bin\ :: Path to cleanup script file (the file with all of the cleanup code in it) set mysqlcleanup="D:\Epoch16\SERVER_MAINTAIN.sql" "%mysqlpath%\mysql.exe" -h %MYSQLHOST% --user=%mysqluser% --password=%mysqlpassword% --database=%mysqlschema% < %mysqlcleanup% ::add PAUSE below if u wanna see what happend exit SERVER_MAINTAIN.sql (i use a lil modify of the one by bigegg and i think @BigEgg yours need add the function to find vehicles without key.. otherway drops an error with this line (AND FindVehicleKeysCount(Object_DATA.CharacterID) = 0;) Reveal hidden contents -- ---------------------------- -- Unlock vehicle's with no key. -- ---------------------------- UPDATE `Object_DATA` SET `Object_DATA`.`CharacterID` = 0,`LastUpdated` = `LastUpdated` WHERE `Object_DATA`.`CharacterID` <> 0 AND`Object_DATA`.`CharacterID` <= 12500 AND`Object_DATA`.`Classname` NOT LIKE 'Tent%' AND`Object_DATA`.`Classname` NOT LIKE '%Locked' AND`Object_DATA`.`Classname` NOT LIKE 'Land%' AND`Object_DATA`.`Classname` NOT LIKE 'Cinder%' AND`Object_DATA`.`Classname` NOT LIKE 'Wood%' AND`Object_DATA`.`Classname` NOT LIKE 'Metal%' AND`Object_DATA`.`Classname` NOT LIKE '%Storage%' AND`Object_DATA`.`Classname` NOT IN ('OutHouse_DZ', 'GunRack_DZ', 'WorkBench_DZ', 'Sandbag1_DZ', 'FireBarrel_DZ', 'DesertCamoNet_DZ', 'StickFence_DZ', 'LightPole_DZ', 'DeerStand_DZ', 'ForestLargeCamoNet_DZ', 'Plastic_Pole_EP1_DZ', 'Hedgehog_DZ', 'FuelPump_DZ', 'Fort_RazorWire', 'SandNest_DZ', 'ForestCamoNet_DZ', 'Fence_corrugated_DZ', 'CanvasHut_DZ', 'Generator_DZ') AND FindVehicleKeysCount(Object_DATA.CharacterID) = 0; Ahhhhh yes - I keep that function in the database table itself. juandayz 1 Link to comment Share on other sites More sharing options...
0 juandayz Posted June 10, 2017 Report Share Posted June 10, 2017 Just now, BigEgg said: Ahhhhh yes - I keep that function in the database table itself. yupp really was oldmatechoc who notice me about it... Nice job Bigegg! really apreciate it... for otherone who need the function Spoiler -- ---------------------------- -- Function structure for FindVehicleKeysCount -- ---------------------------- DROP FUNCTION IF EXISTS `FindVehicleKeysCount`; DELIMITER ;; CREATE FUNCTION `FindVehicleKeysCount`(`keyId` INT) RETURNS int(11) BEGIN DECLARE totalKeys INT DEFAULT 0; DECLARE keyName VARCHAR(32) DEFAULT ""; DECLARE keysInChar INT DEFAULT 0; DECLARE keysInObj INT DEFAULT 0; SET keyName = (CASE WHEN `keyId` < 2501 THEN CONCAT('ItemKeyGreen', `keyId`) WHEN `keyId` < 5001 THEN CONCAT('ItemKeyRed', `keyId` - 2500) WHEN `keyId` < 7501 THEN CONCAT('ItemKeyBlue', `keyId` - 5000) WHEN `keyId` < 10001 THEN CONCAT('ItemKeyYellow', `keyId` - 7500) WHEN `keyId` < 12501 THEN CONCAT('ItemKeyBlack', `keyId` - 10000) ELSE 'ERROR' END); SET keysInChar = (SELECT COUNT(*) FROM `Character_DATA` WHERE `Alive` = '1' AND (`Inventory` LIKE CONCAT('%', keyName, '%') OR `Backpack` LIKE CONCAT('%', keyName, '%'))); SET keysInObj = (SELECT COUNT(*) FROM `Object_DATA` WHERE `Inventory` LIKE CONCAT('%', keyName, '%')); RETURN (keysInChar + keysInObj); END just run as query in your navicat or the program that use and gonna be added as function Link to comment Share on other sites More sharing options...
0 totis Posted October 13, 2017 Report Share Posted October 13, 2017 Can i ask a question about this? Im using gtx hosted servers, i have installed phpmyadmin and seems with gtx its the only way to do maintenance. As Vladik said: Quote Can't you just run these SQL statements as Events in phpMyAdmin? So i just put the pieces of code as events on phpmyadmin and it will execute them? Tnx Link to comment Share on other sites More sharing options...
0 lwbuk Posted October 13, 2017 Report Share Posted October 13, 2017 Download navicat and connect to your database that way. Much better than phpmyadmin and you can set up backups, queries, events etc. Youll probably need to contact gtx and ask them to turn the event scheduler on, as it’s off from default. Link to comment Share on other sites More sharing options...
0 totis Posted October 13, 2017 Report Share Posted October 13, 2017 Tnx for answering Iwbuk. I already did as events on phpmyadmin was off by gtx and they enabled it. But i will send them an email again asking that precisely. Link to comment Share on other sites More sharing options...
0 totis Posted October 13, 2017 Report Share Posted October 13, 2017 Can i use heidisql instead? Link to comment Share on other sites More sharing options...
0 theduke Posted October 13, 2017 Report Share Posted October 13, 2017 3 minutes ago, totis said: Can i use heidisql instead? yes Link to comment Share on other sites More sharing options...
0 totis Posted October 13, 2017 Report Share Posted October 13, 2017 Tnx for answering theduke Ok. I have also heidi and i can see my events there. How to tell if they running? Do i need to do anything else? Or can i execute them manually? I tried to google it but i cant seem to find any guide simple enough :) Link to comment Share on other sites More sharing options...
0 totis Posted October 14, 2017 Report Share Posted October 14, 2017 Btw these 2 arent they doing the same thing? Spoiler -- Delete vehicles with no keys. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 2 DAY) AND `CharacterID` = '0' AND `Classname` IN ('AN2_DZ','GNT_C185U','GNT_C185','GNT_C185R','GNT_C185C','RHIB','Smallboat_1','Smallboat_2'); and this: Spoiler -- ---------------------------- -- Delete server spawned vehicles. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY) AND `CharacterID` = '0' AND `Classname` NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara'; I mean if you ignore the NOTregexp category and you leave classname empty, will it not delete any vehicle that doesnt have a key? character id =0 means vehicles without id = key? Link to comment Share on other sites More sharing options...
0 theduke Posted October 14, 2017 Report Share Posted October 14, 2017 18 hours ago, totis said: Tnx for answering theduke Ok. I have also heidi and i can see my events there. How to tell if they running? Do i need to do anything else? Or can i execute them manually? I tried to google it but i cant seem to find any guide simple enough :) I personally always had problems with the events. I ended up making a SQL file and on each restart it runs on the database... But i also have a dedicated box. Since you are using GTX, using PHPmyadmin you should have a button on the home page about events, and it lets you turn them on and off. Link to comment Share on other sites More sharing options...
0 totis Posted October 14, 2017 Report Share Posted October 14, 2017 I solved that part duke. gtx enabled it and its working now :) I was asking what that code does, maybe its unnecessary to my server juandayz 1 Link to comment Share on other sites More sharing options...
0 theduke Posted October 14, 2017 Report Share Posted October 14, 2017 1 hour ago, totis said: I solved that part duke. gtx enabled it and its working now :) I was asking what that code does, maybe its unnecessary to my server The first one looks for vehicles that a player might of lost the key. So a purchased vehicle without a key, gets deleted after 2 days The second one deletes map spawn vehicles to allow new ones to spawn, but only if they havnt been touched in 3 days juandayz and totis 2 Link to comment Share on other sites More sharing options...
0 juandayz Posted October 14, 2017 Report Share Posted October 14, 2017 @totis if ure runing this block_ Spoiler -- ---------------------------- -- Unlock vehicle's with no key. -- ---------------------------- UPDATE `Object_DATA` SET `Object_DATA`.`CharacterID` = 0,`LastUpdated` = `LastUpdated` WHERE `Object_DATA`.`CharacterID` <> 0 AND`Object_DATA`.`CharacterID` <= 12500 AND`Object_DATA`.`Classname` NOT LIKE 'Tent%' AND`Object_DATA`.`Classname` NOT LIKE '%Locked' AND`Object_DATA`.`Classname` NOT LIKE 'Land%' AND`Object_DATA`.`Classname` NOT LIKE 'Cinder%' AND`Object_DATA`.`Classname` NOT LIKE 'Wood%' AND`Object_DATA`.`Classname` NOT LIKE 'Metal%' AND`Object_DATA`.`Classname` NOT LIKE '%Storage%' AND`Object_DATA`.`Classname` NOT IN ('OutHouse_DZ', 'GunRack_DZ', 'WorkBench_DZ', 'Sandbag1_DZ', 'FireBarrel_DZ', 'DesertCamoNet_DZ', 'StickFence_DZ', 'LightPole_DZ', 'DeerStand_DZ', 'ForestLargeCamoNet_DZ', 'Plastic_Pole_EP1_DZ', 'Hedgehog_DZ', 'FuelPump_DZ', 'Fort_RazorWire', 'SandNest_DZ', 'ForestCamoNet_DZ', 'Fence_corrugated_DZ', 'CanvasHut_DZ', 'Generator_DZ') AND FindVehicleKeysCount(Object_DATA.CharacterID) = 0; remember run the function to find vehicles without keys. ( if u dont have this function the sql event should be stop) So go to your heidy or navicat or whatever program you are using and run it as query over your db one single time. -- ---------------------------- -- Function structure for FindVehicleKeysCount -- ---------------------------- DROP FUNCTION IF EXISTS `FindVehicleKeysCount`; DELIMITER ;; CREATE FUNCTION `FindVehicleKeysCount`(`keyId` INT) RETURNS int(11) BEGIN DECLARE totalKeys INT DEFAULT 0; DECLARE keyName VARCHAR(32) DEFAULT ""; DECLARE keysInChar INT DEFAULT 0; DECLARE keysInObj INT DEFAULT 0; SET keyName = (CASE WHEN `keyId` < 2501 THEN CONCAT('ItemKeyGreen', `keyId`) WHEN `keyId` < 5001 THEN CONCAT('ItemKeyRed', `keyId` - 2500) WHEN `keyId` < 7501 THEN CONCAT('ItemKeyBlue', `keyId` - 5000) WHEN `keyId` < 10001 THEN CONCAT('ItemKeyYellow', `keyId` - 7500) WHEN `keyId` < 12501 THEN CONCAT('ItemKeyBlack', `keyId` - 10000) ELSE 'ERROR' END); SET keysInChar = (SELECT COUNT(*) FROM `Character_DATA` WHERE `Alive` = '1' AND (`Inventory` LIKE CONCAT('%', keyName, '%') OR `Backpack` LIKE CONCAT('%', keyName, '%'))); SET keysInObj = (SELECT COUNT(*) FROM `Object_DATA` WHERE `Inventory` LIKE CONCAT('%', keyName, '%')); RETURN (keysInChar + keysInObj); END Link to comment Share on other sites More sharing options...
0 totis Posted October 14, 2017 Report Share Posted October 14, 2017 Tnx for helping theduke and juan My entire code as i have it now: Spoiler -- -------------------------------------------------------------------------------- -- --------------------------------Base Maintenance-------------------------------- -- -------------------------------------------------------------------------------- -- ---------------------------- -- Fix inventory on maintainable objects. -- ---------------------------- UPDATE `object_data` SET `inventory` = '[]',`LastUpdated` = `LastUpdated` WHERE `inventory` = '[[[],[]],[[],[]],[[],[]]]' AND `Classname` IN ('BagFenceRound_DZ','CinderWall_DZ','CinderWallHalf_DZ','FireBarrel_DZ','GunRack_DZ','LightPole_DZ', 'MetalFloor_DZ','MetalPanel_DZ','OutHouse_DZ','TentStorage','TentStorageDomed','TentStorageDomed2','Sandbag1_DZ','Scaffolding_DZ','StickFence_DZ','StorageShed_DZ','WorkBench_DZ', 'WoodCrate_DZ','WoodFloor_DZ','WoodFloorQuarter_DZ','WoodLargeWall_DZ','WoodLargeWallWin_DZ','WoodShack_DZ','WoodSmallWall_DZ','WoodSmallWallThird_DZ','WoodSmallWallWin_DZ', 'WoodFloorHalf_DZ','Fort_RazorWire','WoodStairsRails_DZ','WoodLadder_DZ','WoodStairsSans_DZ','M240Nest_DZ',"Baseball","Loudspeaker","MetalBucket", "SmallTable","Barrel1","Garbage_can","Land_Rack_EP1","Land_Table_EP1","Land_Shelf_EP1","WoodChair","Park_bench2","Park_bench1","Hhedgehog_concrete","Land_CncBlock", "Land_CncBlock_Stripes","M2StaticMG","DSHKM_CDF","SearchLight_CDF","Land_Cabinet_EP1","Land_Chest_EP1","FlagCarrierUSA","FlagCarrierRU","FlagCarrierINS","Land_Sunshade_EP1","HeliH", "Land_MBG_Beach_Chair_1","Land_MBG_Beach_Chair_2","Land_MBG_Beach_Chair_3","FlagCarrierRedCross_EP1","FlagCarrierGermany_EP1","FlagCarrierCzechRepublic_EP1","Loudspeakers_EP1", 'Plastic_Pole_EP1_DZ','CinderWallDoorSmallLocked_DZ','CinderWallDoorLocked_DZ','CinderWallSmallDoorway_DZ','CinderWallDoorway_DZ', 'Land_DZE_WoodDoorLocked','CinderWallDoor_DZ','CinderWallDoorSmall_DZ','Land_DZE_WoodDoor','Land_DZE_GarageWoodDoor','Land_DZE_GarageWoodDoorLocked', 'Land_DZE_LargeWoodDoorLocked','Land_DZE_LargeWoodDoor','WoodLargeWallDoor_DZ', "Misc_Videoprojektor","Misc_Videoprojektor_platno","Misc_Wall_lamp","Notebook","SatPhone","Radio","SmallTV","Suitcase","Desk","FoldChair","FoldTable"); -- ---------------------------- -- Set 0.1 damage to objects daily. -- ---------------------------- UPDATE `object_data` SET `Damage` = IF( `Damage` = 0.0, 0.1, `Damage` + 0.1 ) WHERE `LastUpdated` <= DATE_SUB(NOW(), INTERVAL 1 DAY) AND `ObjectUID` <> 0 AND `CharacterID` <> 0 AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') ); -- ---------------------------- -- Set 0.1 damage doors/plots daily. -- ---------------------------- UPDATE `object_data` SET `Damage` = IF( `Damage` = 0.0, 0.1, `Damage` + 0.1 ) WHERE `Classname` IN ('Plastic_Pole_EP1_DZ','CinderWallDoorSmallLocked_DZ','CinderWallDoorLocked_DZ','CinderWallSmallDoorway_DZ','CinderWallDoorway_DZ', 'Land_DZE_WoodDoorLocked','CinderWallDoor_DZ','CinderWallDoorSmall_DZ','Land_DZE_WoodDoor','Land_DZE_GarageWoodDoor','Land_DZE_GarageWoodDoorLocked', 'Land_DZE_LargeWoodDoorLocked','Land_DZE_LargeWoodDoor','WoodLargeWallDoor_DZ') AND `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 1 DAY) AND `Inventory` != '[]'; -- ---------------------------- -- Set lockbox combinations to RED00 after 9 days of inactivity. -- ---------------------------- UPDATE `object_data` SET `CharacterID` = 10000 WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 9 DAY) AND `CharacterID` > 0 AND `Classname` = "LockboxStorageLocked" AND `Inventory` <> '[]' AND `Inventory` IS NOT NULL; -- ---------------------------- -- Delete empty storage objects after 3 days. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY) AND ( (`Inventory` IS NULL) OR (`Inventory` = '[]') OR (`Inventory` = '[[[],[]],[[],[]],[[],[]]]') ) AND `Classname` IN ('Wooden_shed_DZ','WoodShack_DZ', 'TentStorage', 'TentStorageDomed', 'TentStorageDomed2', 'WoodCrate_DZ', 'GunRack_DZ', 'OutHouse_DZ', 'StorageShed_DZ'); -- ---------------------------- -- Delete inactive storage objects after 5 days. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 5 DAY) AND `Classname` IN ('Wooden_shed_DZ','WoodShack_DZ', 'TentStorage', 'TentStorageDomed', 'TentStorageDomed2', 'WoodCrate_DZ', 'GunRack_DZ', 'OutHouse_DZ', 'StorageShed_DZ'); -- ---------------------------- -- Delete objects that have 1 damage. -- ---------------------------- DELETE FROM `object_data` WHERE Damage = 1; -- ---------------------------- -- Delete plot poles and doors not being deleted after 10 days. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND `Classname` IN ('Plastic_Pole_EP1_DZ','CinderWallDoorSmallLocked_DZ','CinderWallDoorLocked_DZ','CinderWallSmallDoorway_DZ','CinderWallDoorway_DZ','Land_DZE_WoodDoorLocked','CinderWallDoor_DZ','CinderWallDoorSmall_DZ','Land_DZE_WoodDoor','Land_DZE_GarageWoodDoor','Land_DZE_GarageWoodDoorLocked','Land_DZE_LargeWoodDoorLocked','Land_DZE_LargeWoodDoor','WoodLargeWallDoor_DZ'); -- ---------------------------- -- Delete old stuff not maintained after 15 days. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 15 DAY); -- -------------------------------------------------------------------------------- -- ------------------------------Vehicle Maintenance------------------------------- -- -------------------------------------------------------------------------------- -- ---------------------------- -- Delete Bikes, ATV's, Mozzie's and Busses. -- ---------------------------- DELETE FROM `object_data` WHERE `Classname` IN ('MMT_Civ','Old_bike_TK_INS_EP1','TT650_Civ','TT650_Ins','Old_moto_TK_Civ_EP1','M1030_US_DES_EP1','TT650_TK_CIV_EP1','ATV_CZ_EP1','ATV_US_EP1','CSJ_GyroC','CSJ_GyroP','CSJ_GyroCover','Ikarus','Ikarus_TK_CIV_EP1'); -- ---------------------------- -- Delete vehicles with no keys. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 2 DAY) AND `CharacterID` = '0' AND `Classname` IN ('AN2_DZ','GNT_C185U','GNT_C185','GNT_C185R','GNT_C185C','RHIB','Smallboat_1','Smallboat_2','Zodiac','Fishing_Boat','PBX','JetSkiYanahui_Case_Red','JetSkiYanahui_Case_Yellow', 'JetSkiYanahui_Case_Green','JetSkiYanahui_Case_Blue','CSJ_GyroP','CSJ_GyroCover','LandRover_CZ_EP1','LandRover_TK_CIV_EP1','HMMWV_M1035_DES_EP1','HMMWV_Ambulance','HMMWV_Ambulance_CZ_DES_EP1', 'HMMWV_DZ','HMMWV_DES_EP1','Civcar','Civcarbu','civcarbl','Civcarre','Civcarge','Civcarwh','Civcarsl','hilux1_civil_3_open_EP1','datsun1_civil_3_open_DZE','hilux1_civil_1_open_DZE','datsun1_civil_2_covered_DZE', 'datsun1_civil_1_open_DZE','hilux1_civil_2_covered_DZE','Skoda','SkodaBlue','SkodaGreen','SkodaRed','VolhaLimo_TK_CIV_EP1','Volha_1_TK_CIV_EP1','Volha_2_TK_CIV_EP1','VWGolf','car_hatchback','car_sedan', 'GLT_M300_LT','GLT_M300_ST','Lada1','Lada1_TK_CIV_EP1','Lada2','Lada2_TK_CIV_EP1','LadaLM','SUV_TK_CIV_EP1','SUV_Blue','SUV_Charcoal','SUV_Green','SUV_Orange','SUV_Pink','SUV_Red','SUV_Silver','SUV_White', 'SUV_Yellow','SUV_Camo','UAZ_CDF','UAZ_INS','UAZ_RU','UAZ_Unarmed_TK_CIV_EP1','UAZ_Unarmed_TK_EP1','UAZ_Unarmed_UN_EP1'); -- ---------------------------- -- Delete server spawned vehicles. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY) AND `CharacterID` = '0' AND `Classname` NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara'; -- ---------------------------- -- Delete all vehicles not touched in 10 days. -- ---------------------------- DELETE FROM `object_data` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 10 DAY) AND `Classname` NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara'; -- ---------------------------- -- Unlock purchased, inactive vehicles after 9 days. -- ---------------------------- UPDATE `object_data` SET `CharacterID` = 0,`LastUpdated` = `LastUpdated` WHERE `LastUpdated` < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 9 DAY) AND `CharacterID` > 0 AND `Classname` NOT REGEXP 'barrier|storage|shed|bench|wall|floor|fence|pump|wood|hrescue|stick|pole|generator|panel|house|rack|bag|stand|barrel|canvas|wire|hedgehog|net|trap|ramp|fort|sand|scaffold|nest|killhouse|villa|castle|pub|shelter|stodola|garage|MBG|warehouse|sara'; -- -------------------------------------------------------------------------------- -- -------------------------------Player Maintenance------------------------------- -- -------------------------------------------------------------------------------- -- ---------------------------- -- Delete dead characters every time it runs. -- ---------------------------- DELETE from Character_data USING Character_data, Character_data as tempchartable WHERE (Character_data.PlayerUID = tempchartable.PlayerUID) AND (NOT Character_data.alive = tempchartable.alive) AND (Character_data.alive = 0); -- ---------------------------- -- Delete characters inactive for 30 days. -- ---------------------------- DELETE FROM Character_DATA WHERE LastLogin < NOW() - INTERVAL 30 DAY; What you think? Any apparent mistake or maybe something i should add? Link to comment Share on other sites More sharing options...
0 Alone Posted December 13, 2017 Report Share Posted December 13, 2017 I can I delete all data from the "Player_login" table, cause no problem to the players? Link to comment Share on other sites More sharing options...
Question
DieTanx
Hello, i am looking for somebody to possibly share clean up scripts beyond the stock scripts that come with the epoch now.
I would like to reduce the size of my database, its getting quite large and is starting to lag server the more it grows.
Please and thank you.
Link to comment
Share on other sites
49 answers to this question
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now