# # Service File # To make https_demo server as a service # # # Step 1: Copy this service file into system # $ sudo cp https_demo.service /etc/systemd/system # # Step 2: Make a log directory # $ sudo mkdir /var/log/https_demo # # Step 3: Start the service # $ sudo systemctl start https_demo # # Step 4: Check the status of the service # $ sudo systemctl status https_demo # # Step 5: Check the net status # $ sudo netstat -ntlp [Unit] Description=eastgate home page ConditionPathExists=/home/mohan/projects/https_demo After=network.target StartLimitIntervalSec=0 [Service] Type=simple Restart=always RestartSec=1 User=mohan WorkingDirectory=/home/mohan/projects/https_demo ExecStart=/home/mohan/projects/https_demo/https_demo # make sure log directory exists and owned by syslog PermissionsStartOnly=true ExecStartPre=/bin/mkdir -p /var/log/https_demo ExecStartPre=/bin/chown syslog:adm /var/log/https_demo ExecStartPre=/bin/chmod 755 /var/log/https_demo StandardOutput=syslog StandardError=syslog SyslogIdentifier=https_demo [Install] WantedBy=multi-user.target