Alteiria / pterodactylAutoStart

Pterodactyl bash script to auto start servers (at boot for example)
2 stars 2 forks source link

Help Settings up AutoStart #1

Open trentnbauer opened 5 years ago

trentnbauer commented 5 years ago

Hi There, I've set up the AutoStart script but it does not work. I've set the description of my servers to "alwaysStart" but I am unsure how to troubleshoot it as I'm relatively new to Linux.

Is there a command I can type to view a log file and see where it is breaking?

Sorry for the silly question...

Thanks,

unixfox commented 5 years ago

Hello, How did you setup the script? Using the .service file or with cron? If you didn't use the .service did you set the correct environment variables?

trentnbauer commented 5 years ago

Hi! I set it up as a service. In the service file, I put in the API url (I can browse to the url though it shows a pterodactyl 404) and the token

unixfox commented 5 years ago

Did you generate an account token or an application token?

EDIT: You only need to generate an account API token.

trentnbauer commented 5 years ago

I generated an account API token

Edit: it looks like I've generated both an account and application token. I assume I should be using the account one?

I'll confirm it is the account type shortly

unixfox commented 5 years ago

Yes you only need to specify the account token in the token environment variable because the API that I'm using is only available for accounts created on pterodactyl.

unixfox commented 5 years ago

I just added an installation tutorial in the README: https://github.com/Alteiria/pterodactylAutoStart/blob/master/README.md#installation. Please note that I've renamed the name of the service file.

Maybe you could try it and let me know if you still have issues.

trentnbauer commented 5 years ago

Hi mate, I followed your guide and re-installed the autostart and I am getting this error:

-- Logs begin at Thu 2019-02-21 23:40:32 AEDT, end at Tue 2019-05-07 07:21:22 AEST. --
May 07 07:18:44 pterodactyl systemd[1]: Starting Pterodactyl Auto Start...
May 07 07:19:45 pterodactyl autoStart.bash[20791]: parse error: Invalid numeric literal at line 1, column 7
May 07 07:19:45 pterodactyl autoStart.bash[20791]: /opt/pterodactylAutoStart/autoStart.bash: line 21: ((: i < : syMay 07 07:19:45 pterodactyl systemd[1]: pterodactylAutoStart.service: Main process exited, code=exited, status=1/F
May 07 07:19:45 pterodactyl systemd[1]: pterodactylAutoStart.service: Failed with result 'exit-code'.
May 07 07:19:45 pterodactyl systemd[1]: Failed to start Pterodactyl Auto Start.
lines 1-7/7 (END)
unixfox commented 5 years ago

Can you paste the result of these two commands:

I promise there is no personal information, I'm asking you these two commands to understand why my script can't fetch the server list.

And when you paste the content please use the correct markdown code for embedding code like this:

your log

trentnbauer commented 5 years ago

jq --version reports back "jq-1.6" The second piece of code reports back

{ "errors": [ { "code": "NotFoundHttpException", "status": "404", "detail": "An error was encountered while processing this request." } ]

unixfox commented 5 years ago

Hum that 404 error is not normal. What's your pterodactyl version? You can get it from the panel page at the bottom right corner.

trentnbauer commented 5 years ago

browsing to http://pterodactyl/client and http://10.0.3.2/client shows a pterodactyl themed 404 https://pasteboard.co/IdEqiXo.png

trentnbauer commented 5 years ago

Panel version 0.7.13

unixfox commented 5 years ago

On the curl command did you set http://pterodactyl/client or http://pterodactyl/api/client for the URL ?

trentnbauer commented 5 years ago

sorry, i did /client! i reran it with api/client and got this

{ "object": "list", "data": [ { "object": "server", "attributes": { "server_owner": true, "identifier": "881736dc", "uuid": "881736dc-4988-430a-bd0b-5cb2a36f1f2c", "name": "RPGCraft", "description": "Spigot Minecraft Server\r\nalwaysStart", "limits": { "memory": 16000, "swap": 0, "disk": 60000, "io": 500, "cpu": 300 }, "feature_limits": { "databases": 0, "allocations": 0 } } }, { "object": "server", "attributes": { "server_owner": true, "identifier": "c083853e", "uuid": "c083853e-b14e-4762-953b-1d5ab9f91b60", "name": "Insurgency #1 - Vanilla COOP", "description": "Vanilla COOP server alwaysStart", "limits": { "memory": 4000, "swap": 0, "disk": 12000, "io": 500, "cpu": 200 }, "feature_limits": { "databases": 0, "allocations": 0 } } }, { "object": "server", "attributes": { "server_owner": true, "identifier": "37a14275", "uuid": "37a14275-0366-45e0-bb1e-8855d9ce6da8", "name": "Sunstar Reach", "description": "TES3MP MMO Server", "limits": { "memory": 500, "swap": 0, "disk": 1000, "io": 500, "cpu": 100 }, "feature_limits": { "databases": 0, "allocations": 0 } } }, { "object": "server", "attributes": { "server_owner": true, "identifier": "335520e8", "uuid": "335520e8-f1be-423c-8e8f-e66484b5426a", "name": "Insurgency Sandstorm", "description": "Insurgency Sandstorm", "limits": { "memory": 4000, "swap": 0, "disk": 15000, "io": 500, "cpu": 200 }, "feature_limits": { "databases": 0, "allocations": 0 } } }, { "object": "server", "attributes": { "server_owner": true, "identifier": "8797ce43", "uuid": "8797ce43-6392-411f-af8f-5bcb93a3d2dc", "name": "Insurgency #2 - Modded COOP", "description": "Modded COOP using The Armory Expanded 35bots Medic playlist\r\nalwaysStart", "limits": { "memory": 4000, "swap": 0, "disk": 15000, "io": 500, "cpu": 200 }, "feature_limits": { "databases": 0, "allocations": 0 } } }, { "object": "server", "attributes": { "server_owner": true, "identifier": "bb151a5d", "uuid": "bb151a5d-fb79-4c7e-b15b-9f1002933511", "name": "Day of Infamy #1 - Vanilla COOP", "description": "WIP", "limits": { "memory": 4000, "swap": 0, "disk": 20000, "io": 500, "cpu": 200 }, "feature_limits": { "databases": 0, "allocations": 0 } } }, { "object": "server", "attributes": { "server_owner": true, "identifier": "9c092a8f", "uuid": "9c092a8f-68b7-4ecf-8ea7-f96030a9487f", "name": "ARK", "description": "WIP", "limits": { "memory": 4000, "swap": 0, "disk": 15000, "io": 500, "cpu": 200 }, "feature_limits": { "databases": 0, "allocations": 0 } } }, { "object": "server", "attributes": { "server_owner": true, "identifier": "e9c4f385", "uuid": "e9c4f385-75ff-40ff-af3d-e2ae79f71faf", "name": "Insurgency #3 - Sustained Combat PVP", "description": "WIP", "limits": { "memory": 4000, "swap": 0, "disk": 15000, "io": 500, "cpu": 0 }, "feature_limits": { "databases": 0, "allocations": 0 } } } ], "meta": { "pagination": { "total": 8, "count": 8, "per_page": 15, "current_page": 1, "total_pages": 1, "links": [] } } }

unixfox commented 5 years ago

Can you confirm that you didn't do the same mistake while configuring the environment variable baseurl in the service file? Make sure to have a similar url as http://pterodactyl/api.

EDIT : maybe you could paste here the line of the environment variable baseurl of the service file so that I check if you wrote it correctly.

trentnbauer commented 5 years ago

I have updated the base url to this, but it is still not working Environment=baseURL="http://pterodactyl/api/client"

May 08 08:09:41 pterodactyl systemd[1]: Starting Pterodactyl Auto Start... May 08 08:10:42 pterodactyl autoStart.bash[24339]: parse error: Invalid numeric literal at line 1, column 7 May 08 08:10:42 pterodactyl autoStart.bash[24339]: /opt/pterodactylAutoStart/autoStart.bash: line 21: ((: i < : syntax error: operand expected (error token is "< ") May 08 08:10:42 pterodactyl systemd[1]: pterodactylAutoStart.service: Main process exited, code=exited, status=1/FAILURE May 08 08:10:42 pterodactyl systemd[1]: pterodactylAutoStart.service: Failed with result 'exit-code'. May 08 08:10:42 pterodactyl systemd[1]: Failed to start Pterodactyl Auto Start. May 08 08:11:06 pterodactyl systemd[1]: Starting Pterodactyl Auto Start... May 08 08:12:06 pterodactyl systemd[1]: Started Pterodactyl Auto Start. pterodactyl@pterodactyl:~$

JesFot commented 5 years ago

@xardoniak Don't know if you fixed the issue but I think you should try removing the "/client" part of the baseURL.

unixfox commented 5 years ago

I'll modify the script to avoid that kind of mistake.

trentnbauer commented 5 years ago

Hey, apologies on not getting back to you. I changed the script back to be just /api and I'm unable to get my servers to start via the script. Unsure what I'm doing wrong... any thoughts on what to check next?

I'm more than happy to PM you the autostart script with the token as well as some shots from within Pterodactyl if that helps?

unixfox commented 5 years ago

I plan to modify and add check for errors this week I'll get back to you once it's done.