#Is it possible to shutdown and start a Pod via .sh script and Cron?

18 messages · Page 1 of 1 (latest)

drowsy orioleBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

ruby estuary
#

Yes you could, use runpodctl pod stop $podid

#

Replace pod id with environment variables from the runpod docs

#

Check for a list in the docs, for environment variables existing in pods

ivory fox
#

thanks

#

🙂

#

this also means, everytime the pod is stopped and in idle mode and started again, the pod gets a new ip? while the pod is stopped i cannot connect via terminal ie?

ruby estuary
#

Yes but the http ports stay the same

ivory fox
#

nvm 😄 all fine

#

with api it should be fine

#

#!/bin/bash

API_KEY="key"
POD_ID="pid"

curl -s -H "Content-Type: application/json"
-H "Authorization: Bearer $API_KEY"
-X POST "https://rest.runpod.io/v1/pods/$POD_ID/start"

echo "Pod wird gestartet"

could this work ?

as under API keys we only have .graphql and.ai ..

ivory fox
#

were do i get my rest api key ?

#

Is it even possible from outside? like another VM ( not RunPod.io glaibal network )

ruby estuary
#

Yes

#

Even outside pod

ivory fox
#

ok, then were do i get a rest api key?

#

all i can create here is /graphql endpoint and runpod.ai

ruby estuary