# How to run yc-360 Script as a Linux System Service (systemctl)?

This guide explains how to configure the yc-360 script to run as a system service on your Linux machine using systemctl.

# Prerequisites

  • yc-360 script installed on your system.
  • Basic understanding of systemd and systemctl commands.

# Configure as a System Service

Follow the below steps to run the yc-360 script as a system servce:

# Step 1: Create the Systemd Service File

  • Open a terminal window with root privileges (using sudo).
  • Create a new file named yc-360-script.service under the /etc/systemd/system directory. You can use a text editor like vi or nano.
sudo vi /etc/systemd/system/yc-360-script.service
1

# Step 2: Copy and Edit the Service Configuration

  • Paste the following content into the opened file, replacing placeholders with your specific information:










 

 



 

 















[Unit]
Description=yc-360 Script Service
After=network.target
Wants=network-online.target
StartLimitIntervalSec=500
StartLimitBurst=5

[Service]
Type=simple
# Replace with the actual directory containing the yc-360 script files 
WorkingDirectory=/path/to/folder/linux 
# Replace paths accordingly 
ExecStart=/path/to/folder/linux/yc -m3 -c /path/to/folder/linux/yc-config.yaml 
Restart=on-failure 
RestartSec=5 
# Adjust log file path 
StandardOutput=append:/path/to/folder/linux/yc-360-script.log 
# Adjust error log file path 
StandardError=append:/path/to/folder/linux/yc-360-script-error.log        

## Modify these configuration directives if necessary
# User=ubuntu
# Group=ubuntu
# ProtectSystem=full
# ProtectHome=true
# PrivateTmp=true
# NoNewPrivileges=true
# LimitNOFILE=65536
# LimitNPROC=1024
# TimeoutStopSec=60

[Install]
WantedBy=multi-user.target
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

Refer to systemd documentation (opens new window) for more details

  • Save and close the file.

# Step 3: Reload Systemd

  • Inform systemd about the newly created service file:
sudo systemctl daemon-reload
1

# Step 4: Enable the Service

  • To start the yc-360-script automatically at boot, enable the service:
sudo systemctl enable yc-360-script.service
1

# Step 5: Verify Service Status

  • Check the service status to see if it's running:
sudo systemctl status yc-360-script.service
1

# Step 6: Manage the Service

  • Start the service manually:
sudo systemctl start yc-360-script.service
1
  • Stop the service:
sudo systemctl stop yc-360-script.service
1
  • View logs related to the service:
sudo journalctl -u yc-360-script.service
1

# Additional Notes

  • The provided service configuration defines various options like restart behavior, logging, and resource management. You can customize these options based on your specific needs. Refer to systemd documentation (opens new window) for detailed information on available options.

  • Ensure the user running the service has the necessary permissions to access the yc-360 script binary and configuration file.

Following these steps will configure the yc-360 script to run as a system service, automatically starting at boot and restarting upon failures. You can manage the service using the provided systemctl commands.