手动启动脚本可以运行,但是开机启动怎么都不行。试过在/etc/rc.local添加脚本也不行。折腾好久了。
service seafile-server status
● seafile-server.service - LSB: Seafile server
Loaded: loaded (/etc/init.d/seafile-server; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2017-04-06 04:42:36 CEST; 1min 40s ago
Docs: man:systemd-sysv-generator(8)
Process: 1372 ExecStart=/etc/init.d/seafile-server start (code=exited, status=1/FAILURE)
Apr 06 04:42:28 ubuntu.example.com seafile-server[1372]: ** Message: seafile-controller.c(1091): loading seafdav config from /home/feisu/seafilepro/conf/seafdav.conf
Apr 06 04:42:29 ubuntu.example.com seafile-server[1372]: License file /home/feisu/seafilepro/seafile-license.txt does not exist, allow at most 3 trial users
Apr 06 04:42:36 ubuntu.example.com seafile-server[1372]: failed to run “ccnet-server -t”
Apr 06 04:42:36 ubuntu.example.com sudo[1687]: root : TTY=unknown ; PWD=/ ; USER=feisu ; COMMAND=/home/feisu/seafilepro/seafile-server-latest/seahub.sh start-fast
Apr 06 04:42:36 ubuntu.example.com sudo[1687]: pam_unix(sudo:session): session opened for user feisu by (uid=0)
Apr 06 04:42:36 ubuntu.example.com sudo[1687]: pam_unix(sudo:session): session closed for user feisu
Apr 06 04:42:36 ubuntu.example.com systemd[1]: seafile-server.service: Control process exited, code=exited status=1
Apr 06 04:42:36 ubuntu.example.com systemd[1]: Failed to start LSB: Seafile server.
Apr 06 04:42:36 ubuntu.example.com systemd[1]: seafile-server.service: Unit entered failed state.
Apr 06 04:42:36 ubuntu.example.com systemd[1]: seafile-server.service: Failed with result ‘exit-code’.
我的/etc/init.d/seafile-server 内容为
#!/bin/bash
BEGIN INIT INFO
Provides: seafile-server
Required-Start: $remote_fs $syslog $mysql $network
Required-Stop: $remote_fs $syslog
Default-Start: 2 3 4 5
Default-Stop: 0 1 6
Short-Description: Seafile server
Description: Start Seafile server
END INIT INFO
Change the value of “user” to your linux user name
user=feisu
Change the value of “seafile_dir” to your path of seafile installation
usually the home directory of $user
seafile_dir=/home/feisu/seafilepro
script_path=${seafile_dir}/seafile-server-latest
seafile_init_log=${seafile_dir}/logs/seafile.init.log
seahub_init_log=${seafile_dir}/logs/seahub.init.log
Change the value of fastcgi to false if fastcgi is not used
fastcgi=true
Set the port of fastcgi, default is 8000. Change it if you need different.
fastcgi_port=8000
Write a polite log message with date and time
echo -e "\n \n About to perform $1 for seafile at date -Iseconds
\n " >> ${seafile_init_log}
echo -e "\n \n About to perform $1 for seahub at date -Iseconds
\n " >> ${seahub_init_log}
case “$1” in
start)
sudo -u ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log}
if [ $fastcgi = true ];
then
sudo -u ${user} ${script_path}/seahub.sh ${1}-fastcgi ${fastcgi_port} >> ${seahub_init_log}
else
sudo -u ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log}
fi
;;
restart)
sudo -u ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log}
if [ $fastcgi = true ];
then
sudo -u ${user} ${script_path}/seahub.sh ${1}-fastcgi ${fastcgi_port} >> ${seahub_init_log}
else
sudo -u ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log}
fi
;;
stop)
sudo -u ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log}
sudo -u ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log}
;;
*)
echo “Usage: /etc/init.d/seafile-server {start|stop|restart}”
exit 1
;;
esac
现在只能开机后手动启动它。