I got problems with the: /etc/init.d/seafile-server for Ubuntu and changed the following things:
# 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)
su ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log}
if [ $fastcgi = true ];
then
su ${user} ${script_path}/seahub.sh ${1}-fastcgi ${fastcgi_port} >> ${seahub_init_log}
else
su ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log}
fi
;;
restart)
su ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log}
if [ $fastcgi = true ];
then
su ${user} ${script_path}/seahub.sh ${1}-fastcgi ${fastcgi_port} >> ${seahub_init_log}
else
su ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log}
fi
;;
stop)
su ${user} ${script_path}/seahub.sh ${1} >> ${seahub_init_log}
su ${user} ${script_path}/seafile.sh ${1} >> ${seafile_init_log}
;;
*)
echo "Usage: /etc/init.d/seafile-server {start|stop|restart}"
exit 1
;;
esac
sudo -u is not working correctly with default user rights, and it’s not safe to add the ‘seafile user’ to the sudo list.
Message:
user@cloud:~$ /etc/init.d/seafile-server start
seafile is not in the sudoers file. This incident will be reported.
seafile is not in the sudoers file. This incident will be reported.
This is the final fix after troubleshooting a hour.
The manual is a bit outdated in this chapter. Ubuntu 14.04 was not using systemd, they changed it in 15.04 or something like that. I will correct the manual in the next days.
Edit:
I updated the manual and it has been merged. You can have a look at it under the known hyperlink. You can mark this topic as solved now.
Cron is designed to start scripts/applications at given times like backup jobs or something like that. The systemd approach is way better here because it controlls / supervises the seafile and seahub processes.
For the other approaches, you can see that the init scripts do more than just start the seafile and seahub services - that would be a one-line-script.
Thanks, and then just change the username in the file to my user name.
My seafile setup are running on a VM that only have seafile on it so I did not create a seafile user.
I’m hoping that’s not an issue?
I did not see the point to do that as the VM are dedicated to seafile.
Yes, just change your username to the one you are using as mentioned in the manual. That’s no problem at all but a separate user could improve the security a bit if it does not have root rights like the normal user. I think that’s no problem in your case.
Ok, no I don’t think it’s an issue for me as if they take over the seafile user they can do the same harm to me as if they take the root user as seafile is the only thing that are running on the machine.
I can’t see in my case how it would improve the security.
Got it inside 2 firewalls and I have boosted the security in ubuntu etc
I did find this error log, I’m confused the directory is correct:
Jun 22 21:09:23 seafile systemd[1]: Starting Seafile...
Jun 22 21:09:23 seafile systemd[1445]: seafile.service: Failed at step EXEC spawning /tinytechnet/seafile-server-latest/seafile.sh: No such file or directory
Jun 22 21:09:23 seafile systemd[1]: seafile.service: Main process exited, code=exited, status=203/EXEC
Jun 22 21:09:23 seafile systemd[1]: Failed to start Seafile.
Jun 22 21:09:23 seafile systemd[1]: seafile.service: Unit entered failed state.
Jun 22 21:09:23 seafile systemd[1]: seafile.service: Failed with result 'exit-code'.
Jun 22 21:09:23 seafile systemd[1]: Starting Seafile hub...
Jun 22 21:09:23 seafile systemd[1447]: seahub.service: Failed at step EXEC spawning /tinytechnet/seafile-server-latest/seahub.sh: No such file or directory
Jun 22 21:09:23 seafile systemd[1]: seahub.service: Main process exited, code=exited, status=203/EXEC
Jun 22 21:09:23 seafile systemd[1]: Failed to start Seafile hub.
Jun 22 21:09:23 seafile systemd[1]: seahub.service: Unit entered failed state.
Jun 22 21:09:23 seafile systemd[1]: seahub.service: Failed with result 'exit-code'.