如何让 Diaspora 在服务器启动时启动

发布于 2025-01-02 00:02:02 字数 1459 浏览 2 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

输什么也不输骨气 2025-01-09 00:02:03

首先你需要创建一个初始化脚本:

# 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

如果散居开始,那么你就可以走了。否则脚本可能需要调整。

First you need to create an init script:

# 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

Then make the file executable:

sudo chmod +x /etc/init.d/diaspora

Then you need to tell Ubuntu to start/stop, usually using the default run levels (assuming you saved the previous script in /etc/init.d/diaspora):

sudo update-rc.d diaspora defaults

Then try it out:

sudo service diaspora start

or

sudo /etc/init.d/diaspora start

If diaspora starts then you're good to go. Else the script might need adjustment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文