Line 301: |
Line 301: |
| expand-template /etc/httpd/conf/httpd.conf | | expand-template /etc/httpd/conf/httpd.conf |
| service httpd-e-smith restart | | service httpd-e-smith restart |
| + | </syntaxhighlight> |
| + | |
| + | ==== service start ==== |
| + | <syntaxhighlight lang="bash"> |
| + | cat > /etc/rc.d/init.d/seafile << 'EOF' |
| + | #!/bin/bash |
| + | ### BEGIN INIT INFO |
| + | # Provides: seafile-server |
| + | # Required-Start: $remote_fs $syslog |
| + | # 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=root |
| + | |
| + | # Change the value of "seafile_dir" to your path of seafile installation |
| + | # usually the home directory of $user |
| + | seafile_dir=/opt/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 |
| + | |
| + | |
| + | # |
| + | # 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} |
| + | |
| + | # Python |
| + | sclname='python27' |
| + | . /opt/rh/$sclname/enable |
| + | export X_SCLS="$X_SCLS $sclname" |
| + | |
| + | # we want start daemon only inside "scl enable" invocation |
| + | if ! scl_enabled python27 ; then |
| + | echo "Collection python27 has to be listed in /opt/rh/python27/service-environment" |
| + | exit 1 |
| + | fi |
| + | cd /opt/seafile |
| + | export TOPDIR=/opt/seafile |
| + | export INSTALLPATH=/opt/seafile |
| + | export PYTHONPATH=/opt/seafile:/opt/seafile/seafile-server/seahub/thirdpart:$PYTHONPATH |
| + | export CCNET_CONF_DIR=/opt/seafile/conf/ |
| + | export SEAFILE_CONF_DIR=/opt/seafile/seafile-data/ |
| + | export SEAFILE_CENTRAL_CONF_DIR=/opt/seafile/conf/ |
| + | export SEAHUB_LOG_DIR=/opt/seafile/logs |
| + | export SEAFILE_PIDFILE=/opt/seafile/pids/controller.pid |
| + | |
| + | case "$1" in |
| + | start) |
| + | /usr/bin/seafile-admin start |
| + | ;; |
| + | restart) |
| + | /usr/bin/seafile-admin stop |
| + | /usr/bin/seafile-admin start |
| + | stop) |
| + | /usr/bin/seafile-admin stop |
| + | |
| + | ;; |
| + | *) |
| + | echo "Usage: /etc/init.d/seafile {start|stop|restart}" |
| + | exit 1 |
| + | ;; |
| + | esac |
| + | EOF |
| + | |
| + | chkconfig seafile on |
| + | ln -s /etc/rc.d/init.d/seafile /etc/rc.d/rc7.d/S85seafile |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |