0

I'm currently working on making a spare Raspberry Pi into a headless BitTorrent box, using Deluge.

Most guides on setting up Deluge on Linux include a custom startup script that will be run at boot. However, when you're SSH'd into the Pi, you can start the deluged daemon by simply typing in "deluged".

However, when I wrote a basic bash script which ran this command, put it in /etc/init.d/ and added it using update-rc.d, it didn't work.

nano /etc/init.d/startdeluged.sh
chmod 755 /etc/init.d/startdeluged.sh
update-rc.d startdeluged.sh defaults

The bash script contained this:

#!/bin/sh

deluged
exit

I'm new to setting up startup scripts on Linux, and I'm just wondering why a special script is necessary when simply running a command in the Terminal has the same effect. Does it have anything to do with the user who is entering the command?

4

1 回答 1

1

您必须在#!/bin/sh. 看起来像这样:

### BEGIN INIT INFO
# Provides:          scriptname
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

更多信息:https ://wiki.debian.org/LSBInitScripts

您可能会对此页面上的脚本感兴趣:http ://dev.deluge-torrent.org/wiki/UserGuide/Service/DebianUbuntuInitd

于 2015-03-20T19:04:43.650 回答