Modern Creator
Tech With Tim · YouTube

I Gave Codex a 24/7 Server. Now It Codes While I Sleep.

A 24-minute tutorial on running Codex CLI headlessly on a VPS so your AI coding agent keeps working while you sleep, travel, or are offline.

Posted
1 weeks ago
Duration
Format
Tutorial
educational
Views
18.4K
392 likes
Big Idea

The argument in one line.

A cheap VPS running Codex CLI inside a tmux session turns an AI coding agent from a laptop-tethered process into a 24/7 autonomous worker you can trigger from your phone.

Who This Is For

Read if. Skip if.

READ IF YOU ARE…
  • You use Claude Code or Codex CLI and have lost task progress when your laptop closed or your Wi-Fi dropped.
  • You want to run overnight or multi-hour coding tasks without leaving your computer on.
  • You know how to SSH into a server but have not yet wired up tmux with an AI coding agent.
  • You want daily automated repo tasks — PR reviews, changelog generation, README updates — running on a schedule.
SKIP IF…
  • You already run headless agents in the cloud — this is a beginner-to-intermediate walkthrough, not an advanced production setup.
  • You want a code-only guide; roughly half the runtime is narrated Hostinger dashboard screen capture in a sponsored segment.
TL;DR

The full version, fast.

Running a coding agent on your laptop means every closed lid or dead battery kills the task. The fix is a cheap VPS running Codex CLI inside a named tmux session, which keeps running even when the SSH connection drops. Once the server is up, you SSH from your phone using Termius, attach to the tmux session, and prompt Codex normally. Cron jobs — written by asking Codex itself — schedule repeating tasks like daily PR reviews, changelog generation, or README updates, all running autonomously without your laptop ever needing to be open.

Free for members

Chat with this breakdown — free.

Sign in and you get 23 free chat messages on us — ask for the hook, quote a framework, find the exact transcript moment, generate a markdown action plan. Bring your own key when you want unlimited.

Create a free account →
Chapters

Where the time goes.

00:0000:40

01 · Overview

Hook: half-open laptop as relatable proxy for the problem. Solution teased.

00:4001:43

02 · What You'll Learn

Three deliverables: spin up VPS, install Codex CLI, control from phone.

01:4302:45

03 · Why Codex CLI

Benchmark slide: 78.2% terminal score, ~30% fewer turns, cheaper than Claude Code.

02:4504:04

04 · The VPS Architecture

Mental model: delegate long-running tasks to VPS, do active short-turn work locally.

04:0406:00

05 · VPS Setup

Hostinger KVM2 provisioning with one-click Codex deployment. Sponsored segment with discount code.

06:0007:15

06 · Connecting to the Server

SSH into VPS from local terminal, find IP address, verify root login.

07:1509:20

07 · Installing Codex CLI

curl install command if not pre-installed, device-code sign-in via ChatGPT subscription, test with hello world.

09:2013:21

08 · Connecting GitHub

Fine-grained PAT creation (admin/contents/pull_requests scopes), apt install gh, gh auth login, verify with Codex repo-list prompt.

13:2116:09

09 · tmux Setup

Install tmux, create named session (tmux new -s codex), disconnect demo, tmux ls, tmux attach -t codex. Explains why this is the whole point.

16:0920:24

10 · Triggering from Phone

Termius iOS app setup, add host with IP/root credentials, attach to tmux session, type Codex prompts from mobile, demo PR review.

20:2423:48

11 · Setting up Automations

Cron jobs via codex exec — prompt Codex to write a daily PR-review cron outputting a markdown status file. Dry run shown. Wrap-up.

Atomic Insights

Lines worth screenshotting.

  • A $5/month VPS turns Codex CLI from a laptop-dependent tool into a 24/7 autonomous coding agent.
  • tmux is the single piece of infrastructure that makes headless agents survive disconnects — without it, closing the SSH session kills the task.
  • Codex CLI leads the terminal benchmark at 78.2% vs Claude Opus 4.8 at 74.6%, and finishes the same agentic tasks in roughly 30% fewer turns.
  • codex exec is the non-interactive mode: no session UI, just fire and forget — exactly what cron jobs require.
  • GitHub fine-grained tokens let you scope an agent's repo access precisely — start read-only on pull requests before expanding permissions.
  • Running agents on a VPS grants data center internet speeds, dramatically faster than home Wi-Fi for large downloads or dataset fetches.
  • You can trigger any automation by asking Codex to write the cron job itself — the agent sets up its own recurring schedule.
  • The VPS is an isolated environment: if the agent makes a damaging mistake, you shut it down without touching your own machine.
  • Codex CLI can be authenticated via device code using an existing ChatGPT Plus/Pro subscription — no separate API key needed for most use cases.
  • PR review, changelog generation, and README updates are all valid daily cron candidates once this VPS setup is in place.
Takeaway

What headless agents actually need to run around the clock.

WHAT TO LEARN

Persistent agent execution is not a cloud service you buy — it is three cheap pieces of open infrastructure you wire together yourself.

  • A VPS gives an AI agent the three things a laptop cannot: it never sleeps, its connection does not drop, and it keeps running when the lid closes.
  • tmux is the missing link — without a named persistent session, closing an SSH connection kills any running task no matter how far along it is.
  • codex exec is the non-interactive flag that makes automation possible: it runs a single prompted task and exits, exactly what cron jobs require.
  • GitHub fine-grained tokens let you scope an agent's repo access precisely — start read-only on pull requests before granting write permissions.
  • Asking the agent itself to write the cron job is the fastest path: it knows the correct codex exec invocation and handles crontab syntax without manual guessing.
  • Mobile SSH plus tmux attach turns your VPS into a phone-triggered remote compute node — start a task at the airport, check results at the hotel.
Glossary

Terms worth knowing.

VPS (Virtual Private Server)
A rented remote Linux machine that runs 24/7 with a hardwired connection, used here as a persistent compute host for long-running AI agent tasks.
tmux
A terminal multiplexer that keeps shell sessions alive on the server after you disconnect, so tasks keep running when the SSH connection closes.
Codex CLI
OpenAI's command-line coding agent, capable of reading repos, making commits, reviewing PRs, and running shell commands autonomously.
codex exec
A non-interactive flag for Codex CLI that runs a single prompted task and exits — the mode needed for cron job automation.
cron job
A scheduled task on a Linux server defined in a crontab file; it runs a command automatically at a specified time interval such as daily at 2am.
fine-grained personal access token
A GitHub token that restricts which repos and permissions an application or agent can access, reducing risk if the token is exposed.
gh (GitHub CLI)
The official GitHub command-line tool; installed on the VPS so Codex can run GitHub operations like listing repos, reviewing PRs, and creating branches.
Termius
A free iOS/Android SSH client app that lets you connect to a remote server and run terminal commands from your phone.
Resources

Things they pointed at.

13:21tooltmux
16:09toolTermius (iOS/Android SSH client)
Quotables

Lines you could clip.

00:50
You can actually trigger a task to run from your phone. But the important part is that if that screen closes, your task is going to keep running.
Tight, concrete value prop — no setup neededTikTok hook↗ Tweet quote
23:16
If you want something that's gonna take a long time to run, you just delegate it to VPS, and you don't rely on you having a computer open.
Quotable closer, standalone takeawayIG reel cold open↗ Tweet quote
The Script

Word for word.

Read-along

Don't just watch it. Burn it in.

See every word as it's spoken — crank it to 2× and still catch all of it. The same dual-channel trick behind Amazon's Kindle + Audible.

00:00I'm willing to bet that you've probably seen something like this. Someone walking around with their laptop screen half open, and you know that if they're a programmer, they're waiting for their agent to finish running. I know that this has been me many times.
00:12Even the other day at the airport, was walking around with my laptop screen open looking like a complete idiot because I needed my Cloud Code or Codex agent to finish running. Now this is a problem that doesn't need to exist because you can actually run agents in the cloud if you configure them correctly, and that's what I'm gonna show you how to do in this video.
00:30I'm gonna show you how we can set up codecs so that it's running twenty four seven in the cloud so we never need to have our laptop screen half open walking around looking like a complete idiot. So effectively, what I'm gonna show you in this video is how you can run long running agentic coding tasks in the cloud self hosted using your existing subscriptions.
00:50This means that you can be on the go and that you can actually trigger a task to run from your phone. You can reconnect to it from your laptop. But the important part is that if that screen closes, your task is going to keep running, which means if you're sleeping or if your Wi Fi goes out or if you're in an area where you just can't open your laptop, you can still trigger these agentic tasks to run, and you can actually run them on a schedule, which we'll look at a little bit later.
01:12Now for this video, we're gonna use Codex. The reason for this is that Codex, in my opinion, is currently the best agent out there. Specifically, we're gonna be using Codex CLI.
01:21This is something that can run-in a headless environment that we can execute from our phone, which I'll show you later. Now Codex is currently leading in many of the different benchmarks out there. It can actually run faster than Cloud Code and more importantly, is significantly cheaper to use, especially on a subscription basis in terms of the usage that you get.
01:38It's practically unlimited if you're not running it, you know, in 20 different sessions twenty four seven. So I promise we'll get into the setup, but I just wanna emphasize why this is worth doing. Now if you're gonna run a coding agent on your own computer, you're gonna run, you know, like, ClaudeCode or Codec CLI or just Codecs or whatever, you do need your computer to be open.
01:56And that's because it's using your local execution environment or your compute to actually run a terminal command or modify a file or whatever it is that's going on. Now this is fine in many situations when you're actually gonna be actively on the computer, you're working on something, you're working with it kinda turn by turn, and every prompt you give is taking, you know, maximum a few minutes.
02:14However, if you wanna do a task that's gonna take eight hours or you wanna run a task every day at a certain time or you just want something to run for a super long period of time, but you are not able to actually have your computer open or need speed or backpack or whatever, obviously, this doesn't work. And even if you could run it on your laptop, if you lose Internet, if you lose battery, if you close it, if for some reason it turns off or restarts or goes to sleep or whatever, you're gonna lose all of that progress, which obviously is very inconvenient.
02:42So the solution here is to have a VPS or virtual private server where you can delegate long running tasks. It doesn't mean you're not gonna run stuff locally on your own computer. When you wanna do something and you need to close the lid of your laptop or you know that it's not gonna be available for the next eight, ten, twenty four hours, whatever, you delegate it to the VPS.
02:59So the basic idea is in this video, I'm gonna show you how to spin up a VPS, how to install Codec CLI on it and authenticate with your existing subscription, and then how you can control it from your phone or from your laptop, however you wanna do it. So you can delegate those long running tasks and have everything handled securely privately on that virtual private server.
03:18This way, anytime you need something that's gonna take a few hours, you wanna run something on a schedule, do it on the VPS and then the active work you do on your own computer so you separate things out. Now there's three main reasons why this works. First, a virtual private server doesn't go to sleep.
03:31It's available twenty four seven in a secure environment with a hardwired connection so the Internet just doesn't go out. You keep all of the data because you're self hosting everything, and you can keep everything in a secure environment. And importantly, you also have data center speeds.
03:44So if you're gonna be in a low Internet environment, which I know I am a lot when I'm traveling, you can just use the virtual private server and get significantly faster speeds for downloading something, uploading something, getting a dataset, training a model, whatever it is that you need to do. So, anyways, that is kind of the quick brief here and why this is worth setting up.
04:01Now let me show you exactly how to do Now the first thing we're gonna need here is a virtual private server or VPS. You can get any VPS that you want, but for this video, I'm gonna be using Hostinger because they have some of the best virtual private servers on the market. They're the most reliable, and they're a long term partner of this channel, meaning I can give you guys an additional discount.
04:19So I would recommend going with the k v m two plan if you wanna follow along with me here where you can see all of the options they have. I'll leave a link to this in the description. I'm gonna go with k v m two.
04:29And then from here, what I'm gonna do is deploy and provision my virtual private server. Now because I have a partnership with Hostinger, if you go here and apply the code tech with Tim, you'll get an additional 10% off as long as you're using a twelve month or twenty four month subscription plan here, which gives you a massive discount.
04:42So regardless, pick your plan, pick the duration of what you want, apply the discount code, you can choose the region that you wanna have this applied in. In my case, Indonesia because that's where I'm located right now. And then you can choose OpenAI Codex where it's automatically gonna deploy this and install some of the dependencies for you, which will save you a lot of time.
04:59Hostinger also has a lot of other one click deployments if you wanna have a look at them. But, of course, for this video, we need Codex, so we'll apply that and then go ahead and press on continue. Now if you're following along with me here, it may ask you to generate a root password for the server.
05:11If it does that, can just generate a random one and then copy it obviously, save it, and make sure you don't leak it to anyone else. I will delete this server afterwards. So I'm gonna go ahead and press on next.
05:20I'm gonna add the malware scanner because it's free and obviously just good idea to have on the VPS and then press finish. It's gonna take a minute or two here to provision the VPS. Once it's done, I'll be right back.
05:30I'll show you how we can connect to it and then we can proceed to the next step. Okay. So my VPS is now deployed and what I can do is go to the VPS dashboard here to view all of the different controls and you can see that I have codecs deployed.
05:42Now at this point, I'm gonna assume that you have some virtual private server whether you're using hosting or not doesn't really matter. What we're gonna need to do though is find the IP address of our servers that we can SSH into it and start configuring a few things before we connect it to our phone and before we start setting up scheduled tasks, all of that kind of stuff.
05:59So what I'm gonna do is just copy this right here, the SSH command under root access. Also, right, make sure you have your root password from before. If you forgot it, you can change it right here.
06:08And what I'm gonna do is open up a terminal. So you can see I've got a terminal open on my computer here. Let me just clear this and make it a little bit larger so you guys can see it.
06:16And we're gonna paste the command s s h root at and then the IP address of our server. Again, if you're using a different VPS provider, make sure you get the IP address, you get the username, which is typically root, and then you know the password, uh, for signing in. So let's go ahead and press on enter.
06:31We're gonna go yes and just say, okay. We can connect to this host, and then we're gonna paste in our password.
06:37When you paste the password, you won't see anything here. It will be invisible. So just paste it and then press enter.
06:42Okay. So you can see that I'm now signed in to my virtual private server. You'll see that if you see root at and then some name here, in this case it's SRV, that's just what Hostinger has named.
06:51So now what we need to do is just verify the codex is installed. If it's not, I'll show you how to install it in case you didn't use the one click deploy from Hostinger. We're then gonna need to sign in with our accounts that we can start using our existing subscription or we can use an API key if we want, but that's gonna be quite expensive.
07:06Then after that, I'm gonna show you a few quick setup steps just to make this work really well. Then we're gonna connect it so we can trigger it from our phone, and I'll show you overall how this works, automations, all that kind of fun stuff. Okay.
07:18So first things first, you can attempt to run the Codex command. Now again, if you use the one click install option from Hostinger, it should automatically be installed for you. But if it's not, what you're gonna wanna do is the following.
07:29I'll leave this link in the description. It's just the, uh, docs from Codex, and you'll see that there is a set of command here. So there's a curl.
07:35You can just copy this, paste this as the command, and run it, and that will install the Codec CLI for you. Once it's installed, you may need to just reconnect to the server again so that your path updates because sometimes the path variable needs a second to refresh.
07:50I'm not gonna talk about that too much in-depth, but if you install it and the codex command doesn't work, then just refresh the terminal. So just close it and re SSH back in, and it should work. So from here, we should be able to trigger the codex command.
08:02From here, we're gonna go to sign in with device code. Or if you have your own API key, can use this, but it's probably gonna be better to use your existing ChatGPT subscription. So I'm gonna go sign in with device code, and what it's gonna say is go to this link.
08:13Okay. So we're gonna copy this and just paste it in our browser, and then we're gonna paste this code right here from the terminal. So let's copy this.
08:22Go back. Okay. We're gonna use my email here, and we're gonna paste this device code and then it should allow us to be signed in.
08:28Okay. So let's paste this and press on continue. Okay.
08:31So from here, it says that we're signed in now, and we can go ahead and press on enter. From here, we're just gonna go yes, continue. That's fine.
08:38And you'll see that we've now opened up codex, and we're able to start triggering something. So we can say, you know, hello world, and it will start giving us some input. Now I'm not gonna give you a full tutorial on how Codex works here.
08:48There's a lot of different slash commands that you can use. I'd recommend triggering the fast mode here even though it's gonna use more usage, it's gonna run a lot faster. And if we keep going, you can see there's a lot of other stuff that you can run and that you can do.
09:02Okay. So Codex is now working. We have it running on our computer.
09:05If we want to exit out of this, we can hit control c on our keyboard. That should quit out of Codex, and we can type clear just to clear whatever's in the terminal so we can have kind of a fresh screen. Now what I wanna do next is I wanna show you just how to connect to GitHub because it's gonna be very useful to have codecs connected to GitHub so that it can create repositories for us, do pull requests, trigger automations, etcetera.
09:28If you don't already, I would suggest that you create a free GitHub account. You can do that just by going to github.com. You don't need to pay for anything.
09:35And then what we're gonna do is the following. So first, we're gonna go to our little avatar here, and we're gonna go to settings. Now from settings, we're gonna scroll all the way down to our developer settings, and we're gonna create an API key that we can use in our virtual private server to connect to our GitHub account.
09:52You can actually even give Codex its own GitHub account if you want, but I like connect it to mine and just restrict the access that it has. So what I'm gonna do is go to personal access tokens here and go to fine grained tokens. From fine grained tokens, I'm gonna go create new token.
10:06And what I'm gonna do here is just name this what are we doing here? You know, Codex VPS.
10:11Okay. For the expiration, I'm just gonna go no expiration so we don't need to change it. I'm gonna go all repositories so it can access all of my repositories, and I'm gonna start setting the permissions that I want Codex to have.
10:22Now if I want this to have the ability to create and delete repositories, I need to trigger administration. And if I want it to be able to edit contents of the repository, so make a commit or view it, I need to add contents. Also, I want it to be able to make pull requests.
10:36I need to add pull requests. There's a lot of things here, but for most of you, you're probably just gonna need these. Now for all of these, I would suggest you go read and write.
10:44Again, be careful, but what this is gonna do is allow it to create, to read, delete whatever repositories. Content, same thing. This will allow it to create content, make branches, etcetera.
10:54And then for pull request, this will allow it to pull related comments, assignees, etcetera. Now this is one you might wanna be careful with because if you put it to read and write, it can delete repos. If So you just wanna test it to start, make this read only, which I will do right now.
11:06But if you wanted to be able to make new repos for you and stuff, then you would have to go to read and write. Okay. So from here, we're gonna generate token, but we're gonna do that in one second after we install a tool called g h in our virtual private server.
11:19This is essentially a GitHub tool that Codex will be able to use to do GitHub related commands. Let me show you how it works. Okay.
11:26So from our terminal, we're gonna run the command a p t install g h dash y. Okay? So exactly like I have on screen and go ahead and press on enter.
11:35It's then gonna install g h, which is GitHub effectively, which will take a second. If we wanna test if this is working, we can run g h. Now after that, we're gonna type g h and then I believe the command is not log in.
11:47It might be like okay. So sorry. It's g h off and then log in.
11:51Okay? And then what we're gonna do is authenticate with GitHub. So to do this, we're gonna press github.com, https, and then we're gonna use our git credentials.
12:00Okay. And we're gonna paste an authentication token. So then what we're gonna do is go back here.
12:04We're gonna generate this token. Make sure you don't share it with anyone, and we're just gonna paste it inside of here. Okay.
12:09So we're gonna paste our authentication token that we just generated from the previous step. Now you'll see it's logged in. You can see I'm logged in as tech with Tim.
12:17So now that I'm logged in, my codec should have the ability to actually do things related to GitHub. And if we just wanna test that, we can type codex like this and we can just tell it. We can say, hey.
12:27You have access to the g h command and you wanna use the username tech with tim. Can you just tell me a few repos that you have access to just to verify that the GitHub command is working? By the way, if you're wondering what I'm using to dictate here, I'm using a really cool tool called Whisper Flow.
12:42It's free to use. I have a long term partnership with them, so I'll leave a link to it in the description. You can see I am an absolute power user and is the best voice dictation or AI voice dictation.
12:51It actually has some really cool insights now where you can see exactly where you're using it. The streaks, very cool, very good. And you can see that I can speak at 260 words per minute as opposed to my normal typing speed, which is a lot slower than that.
13:03So anyways, I'm gonna go ahead and press on enter here, and it's just gonna go and try to use this g h command, and let's make sure that it works. Okay. So you can see that it's giving me a whole list of repos here that has access to private and public, which means this is working and GitHub is now installed, active, and we can move on to the next step.
13:21Okay. So the next thing we're gonna do is trigger this from our phone, which means we'll essentially just be able to control the virtual private server and use Codec CLI from our mobile device, and I'm gonna walk you through how to do that. And the first thing we need to do here is install a tool called TMux, k, or TMUX.
13:37What this is gonna allow us to do is persist an SSH session even when we're not connected to the virtual private server. The reason why we're gonna need this tool, we need to run this command that I have right here, is because if we connect to the virtual private server and we do something, so we say, hey, codecs, go do this thing, run CLI, and then we close the terminal, by default, whatever was happening is going to be kind of quit out of or it's gonna be, you know, stopped.
14:01Right? So what TMux will allow us to do is run what's called a persistent session. So even if we disconnect and we're not currently on the virtual private server, whatever we're doing will keep running in the background, which is super important and kind of the whole point of this video.
14:15So we're just going to install TMux like this, a b t install t mux dash y. I'm gonna quickly show you two or three commands that you need to be aware of, and then I'm gonna show you how we can set this up from our phone, which is really easy. So once you have TMux installed, you should be able to run TMux like this.
14:29Okay? Now when you just run TMux let me just, um, exit out of this by typing exit. What it's gonna do is bring you into one of those persistent shells.
14:37Now if we wanna view all of the shells that are currently active with TMux, we can type TMux LS. We can see nothing is running right now because I had started a shell, but then I exit out of it, which by default is going to close it. Now what we can do instead though is we can run TMUX new dash s and then we can give this shell a name.
14:55So in this case, I'm gonna call it codex. And when we do this, it's gonna bring us again into a new TMUX shell here. We can run anything that we want.
15:02So we can run, for example, codex like this, and let's just say, hello world. And now what I'm gonna show you is that if I close this virtual private server session and then try to re, um, kind of enter into it, I can get back into the shell without having any of this information lost.
15:16So let me show you what I mean. I'm just gonna quit out of my terminal. Let's reopen the terminal and re SSH back in.
15:23Okay. Let me just get the password. Okay.
15:25And from here, what I can do now is type TmuxLS. You can see the codex is still running. And then what I can do is type tmux attach.
15:33If I just type tmux attach by default, it's going to attach to the most recent shell, which is going to be codex. Now if I wanna attach to a particular shell because you can have multiple running, then I can do dash t, sorry, and then codex.
15:45And what this is gonna do now is bring me back into that shell. Now, again, if you're not super familiar with virtual private servers, you may not know why this is important, but this again allows us to have this persistent shell so that it can be stored and running in the background no matter what. Okay.
15:59So for now, we're gonna leave this shell running on my computer, and we're gonna move over to our mobile device where I'm gonna show you how we can now connect to the virtual private server so we can trigger tasks on the go from our phone. Okay. So from our phone here, what we're gonna do is go to the App Store, and we need to download what's called an SSH client.
16:14Now you can use anything that you want, but the app that I'm gonna recommend here is called Termius. Okay? It says modern SSH client.
16:21It's free. You don't need to pay for anything, but you need some kind of SSH client. You could do this on Android.
16:26Maybe they have the same app. If not, you're just looking for any SSH client. Okay?
16:31So what we're gonna do is just open up this application, and effectively what we're gonna do is just go and sign into our virtual private server from our phone. So what I can do here is press on the plus button.
16:42I can go new host, and I can start putting in this information. And for the label, I'm just gonna call this codex. Okay.
16:48CLI. For the IP or host name, I'm gonna use the same one that I was using on my computer. So that's one eight seven dot seven seven dot one two one dot eight one.
16:59If you're wondering how do you find this host name, you can see it up here on my computer. I'll hopefully have this on the screen as well. It's the same thing that we're SSH ing into from our computer.
17:07And if you go back to Hostinger, you can actually see it right here or from wherever you deployed your virtual private server. If we keep going, what we'll be able to do is use credentials so we can set our username. This is gonna be root.
17:19And then the password is gonna be the same password that you used previously as the root password for the server. Okay. So I've got all of those details in.
17:26There's not really anything else that we need to do here. Can just go ahead and press on enter and then wait a second here and it should start connecting to this server for us. So if I press on it now, it's gonna say, hey, do you wanna trust this device?
17:38I'm gonna go, yes. I do wanna trust this. And then it's gonna bring me right in to my server.
17:43Now from here, if we wanna change what this looks like, you can see in this app, there's a little button. So I can change, like, do I want it to be light? Do I want it to be dark?
17:50I think it's gonna be easier for you guys to read it in kind of this light mode here, this yellowy color theme. And we can make the text size larger as well. One second.
18:00Um, let me move this here. Okay. So that's pretty much it.
18:03You can set, you know, how you want it to look. And then from here, you can type anything just like you would if you were on your computer. So what we wanna do now is we wanna attach to that TMUX session that we were running here so that we can start using codecs.
18:15And if we don't have an existing session, we should just make a new one so that, again, if we disconnect and reconnect, we're not gonna lose that task. So what we can do is type t mux and then same thing, l s. If we wanna view what we have running, we can see that we have codex and it's currently attached.
18:29So I can do t mux. Okay. And then I'm gonna go attach like that dash t and then codex like so.
18:37And you'll see that I'm now inside of here. It's kind of glitching out on my computer because, what do you call it?
18:42I'm connected on my phone. But you can see that if I type hello or something, it's appearing on my computer as well as on my phone. Now I know it looks a little bit weird and that's just because we're attached from two sessions at the same time.
18:52But you can see now that I can trigger a task. I can ask it to write code. I can get it to do something from my mobile device.
18:58And then again, importantly, if I, like, close the session here on my computer and I go back to my phone, you can see it's still running and it's still going to be able to execute the various tasks. And then again, if we quit out of this, so let's get out of our session and let's go back in, you could see that it will bring us back here.
19:14And then if I want to just completely close out of this, I can press on it, press close. And then if I reconnect here, so give this a second to reconnect. Same thing, can do t mux and then attach.
19:25And then we'll be back in the codec session where we can start asking you to do anything that we want. And I'm gonna change the color theme here so it's a little bit easier to read, uh, because it looks like it's like messing up here. Okay.
19:35So this one looks good. And then we can start triggering various tasks. So just to give you an example of something we can do here, I'm just gonna paste in a URL.
19:44This is one of the GitHub repos I have access to. And I'm just gonna say, hey, can you review all PRs in this repo?
19:53And I know I'm kind of spelling some of this wrong, but that should be fine. Let's go ahead and press on enter and let's see if it can go and review those for us. Okay.
20:00So you can see that it's reviewing all of the PRs right now. It's giving me all of the responses and saying which one should be approved, shouldn't be approved, etcetera, and now we're good to go. And the same thing, we could close it, reopen it, go on our laptop, you get the idea.
20:11Now where this is gonna become super useful is actually when we start running automation. So I wanna show you that now. I am gonna go back to the computer.
20:19But keep in mind, everything that I do on the computer, you could do it from your phone as well. It's just easier for you guys to see on a bigger screen. Okay.
20:25So I'm back on the computer. You can see I've reattached to the TMUX session where we are running from our phone, and now we can continue working. Now like I mentioned, I wanna talk about automations.
20:34Automations are just things that can run on a particular schedule. Now unlike Claude code, Codex doesn't have any built in kind of scheduling feature, although I'm sure they're probably gonna add that in the future. But if we wanna set that up to run on our VPS, it's very easy, and we can create something called a cron job, which is a huge advantage of having this virtual private server.
20:52Now effectively, all we have to do is just tell Codex to do this for us and say, hey. Every day, I want you to do x y z. Maybe I want you to review all of the code in my code base and tell me if there's any security vulnerabilities.
21:05Maybe I want you to review all of the PRs and automatically reject or approve. Maybe I want you to write a change log of anything that's occurred in this repo. Maybe I want you to update all of the read me files, whatever.
21:15Okay? So what I'm gonna do is just the following. I'm gonna say, I wanna set up a simple automation that runs every single day using the Codec CLI.
21:23I need you to create a cron job. This is the key term that you wanna keep in mind, by the way, cron job because that's what you wanted to ask it to do, that runs Codec CLI on the repo that I just sent you above and reviews all of the PRs and then creates a markdown file that's uploaded to the repository that includes the status of those PRs and if they should be approved or not.
21:45This is a silly automation. Like, it doesn't really make sense to run this, but I'm just giving you an example of something you could do. I'm saying, hey.
21:50Set up an automation. I want you to use Codec CLI. I want you to create this cron job and execute this.
21:55Now the way that this is gonna work is there's this command called Codecs exec. And if you run this, it's going to not bring you into a codex session, but it will just execute whatever you ask it to do.
22:07So I could say codex exec and then, like, do this thing. And it will just execute it and do it. So we can set up a cron job that will do that for us.
22:15And I'm just gonna go yes and don't ask for these commands, uh, because it's asking us to approve this. So effectively, what it's gonna do is say, hey. On this schedule, it's gonna be set up on what's called a cron job, which can run on kind of an automated timing, run Codex exec, which is gonna trigger this thing to happen.
22:31Right? Where Codex CLI is gonna go and run this task and then complete whatever it is that we asked it to do. So you can see that it's currently creating this cron job.
22:38We're just putting under a cron tab. It asked me just to approve the command, which I did, and you can see now that the entry is installed, and it's gonna start running this process. So we're just gonna tell it, okay.
22:47Run this. And, the advantage of the VPS is you're in an isolated environment, so it's not gonna mess up your own computer. If it actually makes a mistake, you can always shut it down.
22:55It's not a huge deal. So it's just running all of these Cron terminal commands for us, and it should set this up, and then we will have that automation running every single day.
23:05Okay. So just doing a dry run now to make sure this is gonna work. I'm not gonna bore you guys and go through this whole process.
23:10I just wanted to show you that setting up these automations is a good way to really utilize this VPS and have it running in the background even when you're not manually triggering tasks to execute. And, again, the reason why you want something like this is so that if you want something that's gonna take a long time to run, you just delegate it to VPS, and you don't rely on you having a computer open.
23:29Again, you can set up all these automations. You can have a trigger. You can set up, you know, MCP servers, and you can do really cool stuff using Codec CLI, which is currently kind of the leading agent and harness for coding related tasks.
23:41So that's it, guys. I'm gonna wrap up the video here. If you enjoyed, make sure you leave a like, subscribe to the channel, and I'll see you in another video.
The Hook

The bait, then the rug-pull.

There is a specific kind of programmer embarrassment that comes from walking through an airport with a laptop screen cracked at 30 degrees, pretending to check your bag while actually waiting for a coding agent to finish. This video is the fix: a 24-minute guide to moving that agent off your laptop and onto a server that never closes its lid.

Frameworks

Named ideas worth stealing.

02:42list

Three Reasons a VPS Works for Agents

  1. Never goes to sleep (always-on hardwired connection)
  2. You keep all the data (self-hosted, private)
  3. Data center speeds (faster than home broadband)

The case for delegating long-running agent tasks to a VPS instead of running them locally.

Steal forAny content arguing for self-hosted infrastructure over cloud SaaS
02:45model

Local vs VPS Task Split

  1. Local: active, turn-by-turn work where you watch the output
  2. VPS: long-running tasks (8+ hr), scheduled automations, anything running while you sleep

A simple mental model for when to use each compute environment.

Steal forAny workflow that blends interactive and batch AI usage
CTA Breakdown

How they asked for the click.

VERBAL ASK
23:16subscribe
So that's it, guys. I'm gonna wrap up the video here. If you enjoyed, make sure you leave a like, subscribe to the channel.

Standard end-screen CTA. Newsletter link in description. Hostinger sponsorship woven into the tutorial mid-section.

FROM THE DESCRIPTION
Storyboard

Visual structure at a glance.

hook — laptop prop
hookhook — laptop prop00:00
Codex CLI benchmark slide
promiseCodex CLI benchmark slide01:43
Hostinger dashboard
valueHostinger dashboard04:04
Codex CLI running on VPS
valueCodex CLI running on VPS08:50
tmux session install
valuetmux session install13:21
Termius phone SSH
valueTermius phone SSH16:09
Codex reviewing PRs
valueCodex reviewing PRs20:00
Cron job / codex exec demo
valueCron job / codex exec demo22:00
Dry run complete
ctaDry run complete23:10
Frame Gallery

Visual moments.

Chat about this