Linux Fundamentals for VPS Owners: Systemd, Services, and Process Management

Published on

Essential Linux administration for VPS owners. Covers systemd service management, process monitoring, resource limits, and keeping services running 24/7.

Written by Jochem, Infrastructure Expert, 5-10 years experience in game server hosting, VPS infrastructure, and 24/7 streaming solutions. Read author bio →

Managing a VPS means managing Linux. Understanding systemd, services, and processes is the foundation of server administration.

Systemd Basics

Systemd manages everything that runs on your server:

Essential Commands

CommandPurpose
systemctl status nginxCheck service status
systemctl start nginxStart a service
systemctl stop nginxStop a service
systemctl restart nginxRestart a service
systemctl enable nginxStart at boot
systemctl disable nginxDon't start at boot
systemctl list-units --type=serviceList all services

Service States

StateMeaning
active (running)Service is running normally
active (exited)Started successfully and exited (one-shot)
inactive (dead)Service is stopped
failedService crashed or failed to start
activatingService is starting up

Creating Custom Services

Run your own applications as managed services:

# /etc/systemd/system/myapp.service
[Unit]
Description=My Application
After=network.target

[Service]
Type=simple
User=myuser
WorkingDirectory=/home/myuser/app
ExecStart=/usr/bin/node /home/myuser/app/server.js
Restart=always
RestartSec=5
Environment=NODE_ENV=production
Environment=PORT=3000

[Install]
WantedBy=multi-user.target

Enable and start:

sudo systemctl daemon-reload
sudo systemctl enable myapp
sudo systemctl start myapp

Your app now:

  • Starts automatically on boot
  • Restarts automatically if it crashes
  • Can be managed with systemctl commands
  • Logs to journalctl

Process Management

Viewing Processes

# Real-time process monitor
htop

# Process tree
ps auxf

# Find a specific process
ps aux | grep nginx

# Top CPU consumers
ps aux --sort=-%cpu | head -10

# Top memory consumers
ps aux --sort=-%mem | head -10

Process Signals

SignalCommandEffect
SIGTERM (15)kill PIDGraceful shutdown
SIGKILL (9)kill -9 PIDForce kill (last resort)
SIGHUP (1)kill -1 PIDReload configuration
SIGUSR1kill -USR1 PIDApplication-defined (often log rotation)

Always try SIGTERM first. Only use SIGKILL when SIGTERM fails.

Resource Monitoring

Disk Usage

# Overall disk usage
df -h

# Directory sizes
du -sh /var/log/*

# Find large files
find / -type f -size +100M -exec ls -lh {} \;

Memory Usage

# Memory overview
free -h

# Detailed memory info
cat /proc/meminfo

CPU Usage

# CPU info
lscpu

# Load average
uptime

# Per-core usage
mpstat -P ALL 1

Journalctl (Log Management)

# View service logs
journalctl -u nginx

# Follow logs in real time
journalctl -u myapp -f

# Logs from last hour
journalctl -u nginx --since "1 hour ago"

# Logs from today only
journalctl -u nginx --since today

# Disk space used by logs
journalctl --disk-usage

# Clean old logs
sudo journalctl --vacuum-time=7d

Cron Jobs

Schedule recurring tasks:

crontab -e
ScheduleCron ExpressionExample
Every minute* * * * *Health checks
Every 5 minutes*/5 * * * *Queue processing
Every hour0 * * * *Log rotation
Daily at midnight0 0 * * *Backups
Weekly on Sunday0 0 * * 0Cleanup
Monthly0 0 1 * *Reports

System Hardening

ActionCommandPurpose
Disable unused servicessystemctl disable cupsReduce attack surface
Set resource limitsEdit /etc/security/limits.confPrevent resource exhaustion
Configure log rotationEdit /etc/logrotate.confPrevent disk filling
Monitor failed loginsjournalctl -u sshdSecurity awareness

Space-Node's VPS hosting provides KVM virtualization, meaning you get a real Linux kernel with full systemd support. No containerized limitations, just a real server you fully control.

Jochem

About the Author

Jochem, Infrastructure Expert, expert in game server hosting, VPS infrastructure, and 24/7 streaming solutions with 5-10 years experience.

Since 2023
500+ servers hosted
4.8/5 avg rating

I specialize in Minecraft, FiveM, Rust, and 24/7 streaming infrastructure, operating enterprise-grade AMD Ryzen 9 hardware in Netherlands datacenters.

View my full bio and credentials →

Launch Your VPS Today

Get started with professional VPS hosting powered by enterprise hardware. Instant deployment and 24/7 support included.

Linux Fundamentals for VPS Owners: Systemd, Services, and Process Management