Script /etc/init.d/seafile-server

Hi,

I try to do a script to start seafile at boot following this tuto [script /etc/init.d/seafile-server](http://script /etc/init.d/seafile-server)

This is my script:

#!/bin/sh

BEGIN INIT INFO

Provides: seafile-server

Required-Start: $local_fs $remote_fs $network

Required-Stop: $local_fs

Default-Start: 2 3 4 5

Default-Stop: 0 1 6

Short-Description: Starts Seafile Server

Description: starts Seafile Server

END INIT INFO

Change the value of “user” to linux user name who runs seafile

user=pi

Change the value of “seafile_dir” to your path of seafile installation

usually the home directory of $user

seafile_dir=/media/pi/252d20eb-8ec9-4007-b327-ea678931ef2b/seafile
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 true if fastcgi is to be used

fastcgi=false

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

but when I try my script I have this error:

pi@serveur:/etc/init.d $ sudo ./seafile-server stop
/media/pi/252d20eb-8ec9-4007-b327-ea678931ef2b/seafile/seafile-server-latest/seahub.sh: line 233: kill: (30555) - Operation not permitted
pkill: killing pid 30474 failed: Operation not permitted

I don’t know what I missing…

Can you go to line 233 of the file seahub.sh and copy the line to be able to see it

Hi,
there is the line 233 of seahub.sh:

kill ${pid}

I try to reinstall the script and now I have this:

pi@serveur:/etc/init.d $ sudo ./seafile-server restart
pkill: killing pid 7029 failed: Operation not permitted
/media/pi/252d20eb-8ec9-4007-b327-ea678931ef2b/seafile/seafile-server-latest/seahub.sh: line 207: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8): No such file or directory