安装目录

创建 systemd 服务文件 /etc/systemd/system/seafile.service

vim /etc/systemd/system/seafile.service
[Unit]
Description=Seafile
# add mysql.service or postgresql.service depending on your database to the line below
After=network.target mysql.service

[Service]
Type=oneshot
ExecStart=/root/seafile-server-6.3.4/seafile.sh start
ExecStop=/root/seafile-server-6.3.4/seafile.sh stop
RemainAfterExit=yes
User=root
Group=root

[Install]
WantedBy=multi-user.target

创建 systemd 服务文件 /etc/systemd/system/seahub.service

vim /etc/systemd/system/seahub.service
[Unit]
Description=Seafile hub
After=network.target seafile.service

[Service]
# change start to start-fastcgi if you want to run fastcgi
ExecStart=/root/seafile-server-6.3.4/seahub.sh start
ExecStop=/root/seafile-server-6.3.4/seahub.sh stop
User=root
Group=root
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

设置开机启动项

sudo systemctl enable seafile.service
sudo systemctl enable seahub.service

或者使用 shell 脚本并增加开机启动项

新建 文件 vim /root/sh/auto.sh

#!/bin/sh

source /etc/profile
DIR=/root/sh/auto_log.txt
time=$(date "+%Y-%m-%d %H:%M:%S")
echo 'execute auto '${time} > ${DIR}

sleep 2m
txt1=`/root/seafile-server-latest/seafile.sh restart`
txt2=`/root/seafile-server-latest/seahub.sh restart`
echo ${txt1} >> ${DIR}
echo ${txt2} >> ${DIR}
#rm -rf /var/log/btmp

设置开机启动项 vim /etc/rc.d/rc.local

添加

/root/sh/auto.sh

Nginx 自定义域名 80 端口映射

server
    {
        listen 80;
        server_name seafile.liuguofeng.com ;
        location / {
                 proxy_pass http://127.0.0.1:8000;
        }
    }

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注