0% found this document useful (0 votes)
2 views

Python Browser View

This document provides instructions for creating and managing a systemd service for a Flask application. It details the creation of a service file with specific configurations, followed by steps to reload systemd, start the service, and enable it to run on boot. Additionally, it includes commands to check the service status and view logs if necessary.

Uploaded by

Abitha P
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Python Browser View

This document provides instructions for creating and managing a systemd service for a Flask application. It details the creation of a service file with specific configurations, followed by steps to reload systemd, start the service, and enable it to run on boot. Additionally, it includes commands to check the service status and view logs if necessary.

Uploaded by

Abitha P
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Step 1:Create the Service File

sudo vim /etc/systemd/system/homecopy.service

Edit the following


[Unit]
Description=Flask Application
After=network.target

[Service]
User=root <!--to identify the username enter "whoami
"-->
Group=root <!--to identify the groupname enter "groups
"-->
WorkingDirectory=/path/to/your/app <!--exmaple path"var/www/html/temp"-->
ExecStart=/usr/bin/python3 /path/to/your/app/homecopy.py
Restart=always
Environment="FLASK_ENV=production" # Optional, to set the environment

[Install]
WantedBy=multi-user.target

step2: Reload Systemd and Start Your Service

1.Reload the systemd manager configuration:


sudo systemctl daemon-reload

2.Start the service:


sudo systemctl start homecopy

3.Enable the service to start on boot:


sudo systemctl enable homecopy

Step 3: Check the Status


sudo systemctl status homecopy

View Logs (if needed)


sudo journalctl -u homecopy

You might also like