
You want a server that keeps your bot, script, website or trading tool running while your own PC is off. Does a VPS really run 24 hours a day, and why does your program still stop when you close the terminal? Both answers are below, with the exact settings from the official docs.
Quick answer: Yes, a VPS runs 24 hours a day. It is a virtual machine in a data center and keeps running when your PC is off. What stops your program is usually the setup on the server: closing the SSH or PuTTY window, a crash, a reboot or a full disk. Run the program as a systemd service with Restart=on-failure and RestartSec=5, enable it with systemctl enable --now so it starts after a reboot, and check it from a second machine. "24/7" in VPS hosting means the server running, not the hours of the support desk.
Does a VPS Run 24 Hours a Day?
Your own computer sleeps, drops its Wi-Fi and gets switched off. A VPS is a virtual machine on a server in a data center, with its own operating system and no sleep mode. Closing your SSH session or shutting down your laptop only ends your connection; the machine keeps running.
That is what "24/7 hosting" covers: the virtual machine stays powered on day and night. It does not cover two things:
- Your program. You run the software yourself with root access, so keeping your bot alive is down to your setup, which the rest of this guide covers.
- The support desk. Support hours are a separate line on the provider's page. Read that line on its own.
Even an always-on server gets restarted now and then: by you after an update, by the host for maintenance, or after a hardware fault. Providers give this as a percentage; for 99.9% over a 30-day month the sum is 0.1% × 30 days × 1,440 minutes = 43.2 minutes of downtime. That is arithmetic, not a promise from any host; VPS SLAs explained covers what such guarantees pay out. The point for you: after every restart, your program has to come back without you.
What Stops a Program on a 24/7 VPS
| What happens | Why your program stops | What prevents it |
|---|---|---|
| You close PuTTY or the SSH window | The shell gets a hangup signal (SIGHUP) and exits. The Bash manual: before exiting, an interactive shell resends SIGHUP to all jobs, running or stopped. A program started with & is a job too. | A systemd service. For a quick test, a tmux session or disown -h |
| The program crashes | systemd's documented default is Restart=no: a service that dies stays dead. | Restart=on-failure |
| It crashes again and again | A unit started more than StartLimitBurst= times within StartLimitIntervalSec= is not started any more. Documented defaults: 5 starts in 10 seconds. The journal says "Start request repeated too quickly." | RestartSec=5; systemctl reset-failed clears the counter |
| The VPS runs out of memory | The kernel's OOM killer ends a process and the unit fails. | Restart=on-failure restarts it; more RAM or a leaner program stops it happening |
| The VPS reboots | Only enabled units start at boot. Docker's default restart policy is no; PM2 needs a startup script. | systemctl enable, --restart unless-stopped, pm2 startup plus pm2 save |
| Automatic updates run | unattended-upgrades installs security updates, but its shipped config leaves automatic reboots off. | Reboot at a quiet hour yourself, or set a reboot time |
| The disk fills up | journald caps its files (10% of the file system, at most 4G, by default). Your own log files have no cap, and neither do Docker's json-file logs by default. | Log to stdout under systemd; set max-size and max-file for Docker |
| You log out and user services stop | Without lingering, a user's own systemd manager is not kept after logout. | loginctl enable-linger youruser, for systemctl --user services |
Why not just tmux? Its manual says a session survives an accidental disconnect such as an SSH timeout. It does not survive a reboot or restart a crashed program, and where logind's KillUserProcesses= is on, logging out ends it too. A system service has none of those gaps.
Keep a Program Running 24/7 With systemd
systemd, the service manager on Ubuntu, Debian, AlmaLinux and Rocky Linux, starts the program at boot, restarts it when it fails and keeps its output in the journal. Linux fundamentals for VPS owners covers systemctl in general; this is the minimal file for one program, saved as /etc/systemd/system/mybot.service:
[Unit]
Description=My bot
Wants=network-online.target
After=network-online.target
[Service]
User=bot
WorkingDirectory=/home/bot/app
ExecStart=/usr/bin/python3 -u /home/bot/app/bot.py
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Wants=andAfter=network-online.target: what systemd's docs prescribe for units that strictly need a configured network, such as a bot that connects to an API at start.User=: runs the program as that user instead of root.ExecStart=: the full path to the program.-umakes Python's output unbuffered, so print lines reach the journal straight away. For Node.js, use the pathwhich nodeprints.Restart=on-failure: restarts after a non-zero exit code, a crash signal, a timeout or an OOM kill; the systemd docs call it "the recommended choice for long-running services". It does not restart after a clean exit (code 0, or SIGHUP, SIGINT, SIGTERM or SIGPIPE) orsystemctl stop. If your program exits with 0 when it loses its connection, useRestart=always.RestartSec=5: waits 5 seconds before a restart instead of the default 100 ms.WantedBy=multi-user.target: letssystemctl enablehook the unit into the normal boot.
Load and start it, then follow its output:
sudo systemctl daemon-reload
sudo systemctl enable --now mybot
systemctl status mybot
journalctl -u mybot -f
Why RestartSec matters: the start limit sum
Automatic restarts count toward the start limit of 5 starts per 10 seconds. With the default 100 ms delay, a program that dies right after it starts (a missing token, a typo in the config) uses up its starts within a few seconds, and systemd gives up with "Start request repeated too quickly." With RestartSec=5, starts are at least 5 seconds apart, so no more than 3 fit in any 10-second window. That stays under the limit, and systemd keeps trying every 5 seconds until the network or the API is back.
If a unit has already hit the limit, fix the cause, then run sudo systemctl reset-failed mybot and sudo systemctl start mybot. The limit counts manual starts too. StartLimitIntervalSec=0 in the [Unit] section switches it off.
Logs that cannot fill the disk
A service's standard output goes to the journal by default, and journald keeps its files under SystemMaxUse=: 10% of the file system, capped at 4G. On a 20 GB disk that is about 2 GB; on a 60 GB disk the 4G cap applies. A program that prints to stdout instead of writing its own log file cannot fill the disk with logs. journalctl --disk-usage shows the size, and sudo journalctl --vacuum-size=500M trims old files.
Docker and PM2 Do the Same Job
If your program runs in Docker or under PM2, let that tool handle restarts. Docker's documentation warns against combining its restart policies with a host-level process manager.
--restart policy | Restarts the container when | After Docker restarts (a reboot) |
|---|---|---|
no (default) | Never | Stays stopped |
on-failure[:max-retries] | It exits with a non-zero code, optionally up to a retry limit | Not restarted |
always | It stops | Comes back, even if you stopped it by hand |
unless-stopped | It exits | Comes back, unless you stopped it yourself |
Two rules from the same page: a policy only takes effect after the container has been up for at least 10 seconds, and a container you stop by hand stays stopped until the daemon restarts or you start it again. On Debian and Ubuntu the Docker service starts at boot by default; on other systemd distributions run sudo systemctl enable docker.service and sudo systemctl enable containerd.service. Change the policy of a running container with docker update --restart unless-stopped mycontainer.
For log rotation, put this in /etc/docker/daemon.json. It applies to containers created after Docker restarts; existing ones keep their old settings until you recreate them.
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}
PM2 survives a reboot through its startup script. Run pm2 startup without sudo, copy and run the sudo command it prints, start your apps, then run pm2 save so the list comes back at boot. pm2 resurrect restores the saved list by hand. After a Node.js upgrade, run pm2 unstartup and pm2 startup again so the boot script uses the new Node binary; pm2 startup --wait-ip starts your apps after network-online.target. More in Node.js production setup with PM2 and PM2 app keeps restarting.
Reboots and Automatic Updates
On Ubuntu and Debian, automatic security updates come from unattended-upgrades, configured in /etc/apt/apt.conf.d/50unattended-upgrades and switched on with sudo dpkg-reconfigure unattended-upgrades. The Ubuntu and Debian versions of that file in the project's source ship the reboot settings commented out:
//Unattended-Upgrade::Automatic-Reboot "false";
//Unattended-Upgrade::Automatic-Reboot-Time "02:00";
So your VPS installs updates but does not reboot by itself, and an update that needs a reboot leaves the file /var/run/reboot-required behind. Two choices:
- Reboot yourself at a quiet hour.
ls /var/run/reboot-requiredtells you whether one is waiting. - Set
Unattended-Upgrade::Automatic-Reboot "true";with a time such asUnattended-Upgrade::Automatic-Reboot-Time "04:00";. Without a time, the file gives the default as "now", right after the upgrade. The Debian wiki advises a local copy such as52unattended-upgrades-localinstead of editing the original.
Then test once: sudo reboot, log back in after a minute and check systemctl status mybot, docker ps or pm2 list. A program that does not come back after a planned reboot will not come back after an unplanned one.
Watch It From Outside the VPS
A monitor on the same VPS goes down with it, so it cannot tell you the VPS is down. Run the check on a second small server or a Raspberry Pi at home, with Uptime Kuma or Gatus watching your site or your bot's health endpoint; Self-hosted status page on a VPS walks through both. Add a disk check too: df -h / shows how full the root file system is.
Can I Rent a VPS for Just 24 Hours?
Some large clouds bill by the hour. AWS bills EC2 On-Demand instances by the hour or second with a 60-second minimum (checked 4 November 2026), which suits a server you need for one day.
Space-Node's VPS hosting is billed monthly. You can cancel through the client area at any time and the server stays available until the end of the period you paid for. There is no free trial and no money-back guarantee, so a one-day test costs the monthly price. Delivery is instant: the VPS is set up automatically right after payment, and if it is not ready after 5 to 10 minutes there may be an installation or stock issue, so contact us. Allow time to configure and test your VPS before you need it.
Which Always-On Jobs Fit a VPS
| Job | Keep it running with | Simpler route |
|---|---|---|
| Discord or Telegram bot | A systemd unit or PM2 | Discord bot hosting if you would rather not run Linux; see how to run a Discord bot 24/7 |
| Website or API | systemd, or Docker with unless-stopped, plus an outside check | A VPS is the usual route |
| Automation (n8n, scrapers, scheduled scripts) | Docker with unless-stopped, or systemd services and timers | A VPS is the usual route |
| Game server | A panel such as Pterodactyl, or a systemd service | Game server hosting, if you want a panel without Linux work |
| Minecraft AFK bot | A systemd unit | Minecraft AFK VPS |
| 24/7 live stream | FFmpeg as a systemd service | A streaming VPS with OBS pre-installed; see the 24/7 live stream setup guide |
| Windows-only tools such as trading terminals | A Windows VPS | Windows needs a Windows image and a licence; confirm both and the cost with the host before ordering |
FAQ
Does a VPS turn off when I shut down my PC?
No. The VPS runs in a data center, independent of your computer; shutting down your PC only ends your connection. A program you started by hand in that connection can stop with it, so run it as a systemd service, in Docker with a restart policy, or under PM2.
Why does my script stop when I close PuTTY or SSH?
Closing the window sends your shell a hangup signal (SIGHUP), and the Bash manual says an interactive shell resends SIGHUP to all its jobs before it exits. Your script gets that hangup signal and ends. tmux or disown -h works around it while you test; a systemd service also covers crashes and reboots.
Does a VPS restart on its own after updates?
Not by default on Ubuntu or Debian: the reboot settings in unattended-upgrades' shipped config are commented out, so updates that need a reboot wait for you. The host can still restart the machine for maintenance, so make sure your program starts at boot.
Does 24/7 VPS hosting mean support is open 24/7?
No. "24/7" in VPS hosting means the server keeps running day and night; support hours are separate and differ per host. Space-Node's human support, for example, answers from 08:00 to 20:00 UTC by live chat, Discord and email, and your VPS keeps running outside those hours.
How do I keep a Python script running 24/7 on a VPS?
Use the unit file above with ExecStart=/usr/bin/python3 -u /path/to/script.py, then sudo systemctl enable --now with the service name. With a virtual environment, point ExecStart= at its Python, such as /home/bot/app/venv/bin/python. Read the output with journalctl -u and the service name.
How much does it cost to run a VPS 24/7?
A monthly price covers every hour of the month, so running around the clock costs nothing extra. As of 4 November 2026, Space-Node's Standard VPS-S (3 vCores, 4 GB RAM, 60 GB NVMe) costs €4.99 a month and Premium VPS-XS (2 vCores, 2 GB RAM, 20 GB NVMe) €4.20 a month. VAT depends on your billing country.
Sources
All opened on 4 November 2026:
- Bash Reference Manual: Signals (SIGHUP, disown -h)
- systemd man pages: systemd.service (Restart=, RestartSec=, OOMPolicy=), systemd.unit (StartLimitIntervalSec=, StartLimitBurst=, WantedBy=), systemd-system.conf (default start limit, DefaultStandardOutput=), systemd.exec (User=, WorkingDirectory=, StandardOutput=), systemd.special (network-online.target), systemctl, journald.conf (SystemMaxUse=), journalctl, loginctl (enable-linger), logind.conf (KillUserProcesses=)
- systemd source: src/core/unit.c (the "Start request repeated too quickly." message)
- Docker docs: Start containers automatically, Linux post-installation steps, JSON File logging driver, Docker daemon configuration
- PM2: Startup Script
- unattended-upgrades source: 50unattended-upgrades.Ubuntu, 50unattended-upgrades.Debian; Debian Wiki: UnattendedUpgrades
- tmux manual: tmux(1)
- Python docs: Command line and environment (-u)
- AWS: Amazon EC2 On-Demand Pricing
- Space-Node plan files and the VPS hosting page for prices, specs, billing, setup time and support hours