我写了一个脚本来运行 p2pool。我不明白如何通过“screen -dmS”添加运行?
#! /bin/sh ### BEGIN INIT INFO # Provides: p2pool start # Required-Start: $all # Required-Stop: $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Auto init p2pool start # Description: Auto init p2pool start via booting system # placed in /etc/init.d. ### END INIT INFO # Author: Foo Bar <[email protected]> # # Please remove the "Author" lines above and replace them # with your own name if you copy and modify this script. # Do NOT "set -e" # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin DESC="P2Pool Start" NAME=python DAEMON=/usr/bin/$NAME DAEMON_ARGS="/home/wzor/p2pool/run_p2pool.py --net bitcoin --give-author 0 rpcuser rpcpass -a bitwallet -d A --max-conns 100 --outgoing-conns 10 --fee 0" DAEMON_LOADER="/usr/bin/taskset 0x8 "$DAEMON PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME CHUID=user:user # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. # Depend on lsb-base (>= 3.2-14) to ensure that this file is present # and status_of_proc is working. . /lib/lsb/init-functions # # Function that starts the daemon/service # do_start() { # Return # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON_LOADER --test > /dev/null \ || return 1 start-stop-daemon --start --quiet --chuid $CHUID --pidfile $PIDFILE --exec $DAEMON_LOADER -- \ $DAEMON_ARGS \ || return 2 # Add code here, if necessary, that waits for the process to be ready # to handle requests from services started subsequently which depend # on this one. As a last resort, sleep for some time. }
答案1
我想这就是你要问的:
您需要运行screen -dmS (somenamegoeshere) -X (pathtoscript)
并替换(somenamegoeshere)
一个唯一的名称来识别它以及(pathtoscript)
脚本的路径。