Skip to content

Cheat Sheet Remote Linux Server ​

SSH Connection ​

  1. Just read this Securing The SSH Service | Hetzner
  2. Better to add a firewall

File Transfer Using SCP ​

  1. Transfer from Local to Server
bash
scp -P port /path/to/local/file username@server_ip:/path/to/remote/directory
  1. Transfer from Server to Local
bash
scp username@server_ip:/path/to/remote/file /path/to/local/directory

For path in the server, don't forget to include ~, for example [email protected]:~/quantist

systemd ​

Create A Service File ​

  1. Create a new service file
bash
sudo nano /etc/systemd/system/quantist-dataupdate.service
ini
[Unit]
Description=Quantist Sequential Task Runner
After=network.target

[Service]
User=kevindaffaarr
WorkingDirectory=/home/kevindaffaarr
ExecStart=/bin/bash -c "cd ~/quantist_datascraper && uv run main.py && cd ~/quantist_dataredisjob && bun run index.ts"
StandardOutput=journal
StandardError=journal
Restart=on-failure

[Install]
WantedBy=multi-user.target
  1. Create a Timer (if needed)
ini
[Unit]
Description=Timer for Quantist Sequential Task Runner

[Timer]
OnCalendar=Mon..Fri 10:30
Persistent=true

[Install]
WantedBy=timers.target
  1. Setup Commands
bash
# 1. Reload systemd to recognize the new unit
sudo systemctl daemon-reload

# 2. Enable and start the timer (if needed)
sudo systemctl enable --now quantist-dataupdate.timer
# 3. Verify the timer (if needed)
systemctl list-timers --all
systemctl list-timers --all | grep quantist-dataupdate
# 4. For disabling the timers
sudo systemctl disable quantist-dataupdate.timer
  1. Start and Stop Service
bash
sudo systemctl start quantist-dataupdate.service
sudo systemctl stop quantist-dataupdate.service
sudo systemctl status quantist-dataupdate.service
sudo systemctl list-units --type=service --all
  1. View Logs
bash
# Reverse
sudo journalctl -u quantist-dataupdate.service -r
# Follow Real Time
sudo journalctl -u quantist-dataupdate.service -f
# Add Limit
sudo journalctl -u quantist-dataupdate.service -r -n 50
# Search spesific keywords
sudo journalctl -u <service-name> -r | grep "error"

Sources ​

  1. https://community.hetzner.com/tutorials/securing-ssh
  2. https://community.hetzner.com/tutorials/howto-transfer-files-using-scp

Kevin Daffa Arrahman | Built with VitePress