首先,您需要创建一个初始化脚本:
# This is the init script for starting up the
# Diaspora
#
# chkconfig: 345 91 10
# description: Starts and stops the Diaspora daemon.
#
PROC_NAME=Diaspora
DIASPORA_HOME=/home/diaspora
# Change the user to whichever user you need
RUN_AS_USER=diaspora
startup="cd $DIASPORA_HOME; ./script/server"
# Replace by stop/shutdown command
#shutdown="$DIASPORA_HOME/script/server"
start(){
echo -n $"Starting $PROC_NAME service: "
su -l $RUN_AS_USER -c "$startup"
RETVAL=$?
echo
}
stop(){
echo -n $"Stoping $PROC_NAME service: "
# Uncomment here to allow stop
# su -l $RUN_AS_USER -c "$shutdown"
RETVAL=$?
echo
}
restart(){
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
然后使文件可执行:
sudo chmod +x /etc/init.d/diaspora
然后你需要告诉 Ubuntu 启动/停止,通常使用默认的运行级别(假设你将之前的脚本保存在 /etc/init.d/diaspora):
sudo update-rc.d diaspora defaults
然后尝试一下:
sudo service diaspora start
或者
sudo /etc/init.d/diaspora start
如果散居开始,那么你很高兴。否则脚本可能需要调整。