#!/bin/sh ### BEGIN INIT INFO # Provides: seafile-server # Required-Start: $all # Required-Stop: $all # Should-Start: $local_fs mysql # Should-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 ### END INIT INFO # Change the value of "user" to your linux user name user=root # Change the value of "script_path" to your path of seafile installation seafile_dir=/vol1/seafile script_path=${seafile_dir}/seafile-server-2.0.1 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 case "$1" in start) service mysql start sudo -u ${user} ${script_path}/seafile.sh start > ${seafile_init_log} if [ $fastcgi = true ]; then sudo -u ${user} ${script_path}/seahub.sh start-fastcgi > ${seahub_init_log} else sudo -u ${user} ${script_path}/seahub.sh start > ${seahub_init_log} fi ;; restart) sudo -u ${user} ${script_path}/seafile.sh restart > ${seafile_init_log} if [ $fastcgi = true ]; then sudo -u ${user} ${script_path}/seahub.sh restart-fastcgi > ${seahub_init_log} else sudo -u ${user} ${script_path}/seahub.sh restart > ${seahub_init_log} fi ;; stop) sudo -u ${user} ${script_path}/seafile.sh $1 > ${seafile_init_log} sudo -u ${user} ${script_path}/seahub.sh $1 > ${seahub_init_log} ;; *) echo "Usage: /etc/init.d/seafile {start|stop|restart}" exit 1 ;; esac