Cheat Sheet Remote Linux Server β
SSH Connection β
- Just read this Securing The SSH Service | Hetzner
- Better to add a firewall
File Transfer Using SCP β
- Transfer from Local to Server
bash
scp -P port /path/to/local/file username@server_ip:/path/to/remote/directory
- 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 β
- 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
- 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
- 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
- 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
- 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"