我正在尝试将进程作为守护进程运行
为什么update-rc.d失败?
使用update-rc.d
命令在init.d目录中更新脚本时。
我收到了以下错误。
$ update-rc.d vscpd_startup_script defaults
update-rc.d: using dependency based boot sequencing
insserv: can not remove(../rc0.d/K01fake-hwclock): Permission denied
insserv: can not symlink(../init.d/fake-hwclock, ../rc0.d/K02fake-hwclock): Permission denied
insserv: can not remove(../rc0.d/K08umountroot): Permission denied
insserv: can not symlink(../init.d/umountroot, ../rc0.d/K09umountroot): Permission denied
insserv: can not remove(../rc0.d/K02sendsigs): Permission denied
insserv: can not symlink(../init.d/sendsigs, ../rc0.d/K03sendsigs): Permission denied
insserv: can not remove(../rc0.d/K04umountnfs.sh): Permission denied
insserv: can not symlink(../init.d/umountnfs.sh, ../rc0.d/K05umountnfs.sh): Permission denied
insserv: can not remove(../rc0.d/K03rsyslog): Permission denied
insserv: can not symlink(../init.d/rsyslog, ../rc0.d/K04rsyslog): Permission denied
insserv: can not remove(../rc0.d/K07umountfs): Permission denied
insserv: can not symlink(../init.d/umountfs, ../rc0.d/K08umountfs): Permission denied
insserv: can not remove(../rc0.d/K06hwclock.sh): Permission denied
insserv: can not symlink(../init.d/hwclock.sh, ../rc0.d/K07hwclock.sh): Permission denied
insserv: can not remove(../rc0.d/K01triggerhappy): Permission denied
insserv: can not symlink(../init.d/triggerhappy, ../rc0.d/K02triggerhappy): Permission denied
insserv: can not remove(../rc0.d/K01ifplugd): Permission denied
insserv: can not symlink(../init.d/ifplugd, ../rc0.d/K02ifplugd): Permission denied
insserv: can not remove(../rc0.d/K06networking): Permission denied
insserv: can not symlink(../init.d/networking, ../rc0.d/K07networking): Permission denied
insserv: can not remove(../rc0.d/K05rpcbind): Permission denied
insserv: can not symlink(../init.d/rpcbind, ../rc0.d/K06rpcbind): Permission denied
insserv: can not remove(../rc0.d/K05nfs-common): Permission denied
insserv: can not symlink(../init.d/nfs-common, ../rc0.d/K06nfs-common): Permission denied
insserv: can not remove(../rc0.d/K09halt): Permission denied
insserv: can not symlink(../init.d/halt, ../rc0.d/K10halt): Permission denied
insserv: can not remove(../rc0.d/K01urandom): Permission denied
insserv: can not symlink(../init.d/urandom, ../rc0.d/K02urandom): Permission denied
insserv: can not remove(../rc0.d/K01lightdm): Permission denied
insserv: can not symlink(../init.d/lightdm, ../rc0.d/K02lightdm): Permission denied
insserv: can not remove(../rc0.d/K01alsa-utils): Permission denied
insserv: can not symlink(../init.d/alsa-utils, ../rc0.d/K02alsa-utils): Permission denied
insserv: can not symlink(../init.d/vscpd_startup_script, ../rc0.d/K01vscpd_startup_script): Permission denied
insserv: can not remove(../rc1.d/K01fake-hwclock): Permission denied
insserv: can not symlink(../init.d/fake-hwclock, ../rc1.d/K02fake-hwclock): Permission denied
insserv: can not remove(../rc1.d/K03rsyslog): Permission denied
insserv: can not symlink(../init.d/rsyslog, ../rc1.d/K04rsyslog): Permission denied
insserv: can not remove(../rc1.d/K01triggerhappy): Permission denied
insserv: can not symlink(../init.d/triggerhappy, ../rc1.d/K02triggerhappy): Permission denied
insserv: can not remove(../rc1.d/K01ifplugd): Permission denied
insserv: can not symlink(../init.d/ifplugd, ../rc1.d/K02ifplugd): Permission denied
insserv: can not remove(../rc1.d/K05rpcbind): Permission denied
insserv: can not symlink(../init.d/rpcbind, ../rc1.d/K06rpcbind): Permission denied
insserv: can not remove(../rc1.d/K05nfs-common): Permission denied
insserv: can not symlink(../init.d/nfs-common, ../rc1.d/K06nfs-common): Permission denied
insserv: can not remove(../rc1.d/K01lightdm): Permission denied
insserv: can not symlink(../init.d/lightdm, ../rc1.d/K02lightdm): Permission denied
insserv: can not remove(../rc1.d/K01alsa-utils): Permission denied
insserv: can not symlink(../init.d/alsa-utils, ../rc1.d/K02alsa-utils): Permission denied
insserv: can not symlink(../init.d/vscpd_startup_script, ../rc1.d/K01vscpd_startup_script): Permission denied
insserv: can not remove(../rc2.d/K05rpcbind): Permission denied
insserv: can not symlink(../init.d/rpcbind, ../rc2.d/K06rpcbind): Permission denied
insserv: can not remove(../rc2.d/K05nfs-common): Permission denied
insserv: can not symlink(../init.d/nfs-common, ../rc2.d/K06nfs-common): Permission denied
insserv: can not remove(../rc2.d/K01lightdm): Permission denied
insserv: can not symlink(../init.d/lightdm, ../rc2.d/K02lightdm): Permission denied
insserv: can not symlink(../init.d/vscpd_startup_script, ../rc2.d/S04vscpd_startup_script): Permission denied
insserv: can not remove(../rc3.d/K05rpcbind): Permission denied
insserv: can not symlink(../init.d/rpcbind, ../rc3.d/K06rpcbind): Permission denied
insserv: can not remove(../rc3.d/K05nfs-common): Permission denied
insserv: can not symlink(../init.d/nfs-common, ../rc3.d/K06nfs-common): Permission denied
insserv: can not symlink(../init.d/vscpd_startup_script, ../rc3.d/S04vscpd_startup_script): Permission denied
insserv: can not remove(../rc4.d/K05rpcbind): Permission denied
insserv: can not symlink(../init.d/rpcbind, ../rc4.d/K06rpcbind): Permission denied
insserv: can not remove(../rc4.d/K05nfs-common): Permission denied
insserv: can not symlink(../init.d/nfs-common, ../rc4.d/K06nfs-common): Permission denied
insserv: can not symlink(../init.d/vscpd_startup_script, ../rc4.d/S04vscpd_startup_script): Permission denied
insserv: can not remove(../rc5.d/K05rpcbind): Permission denied
insserv: can not symlink(../init.d/rpcbind, ../rc5.d/K06rpcbind): Permission denied
insserv: can not remove(../rc5.d/K05nfs-common): Permission denied
insserv: can not symlink(../init.d/nfs-common, ../rc5.d/K06nfs-common): Permission denied
insserv: can not symlink(../init.d/vscpd_startup_script, ../rc5.d/S04vscpd_startup_script): Permission denied
insserv: can not remove(../rc6.d/K01fake-hwclock): Permission denied
insserv: can not symlink(../init.d/fake-hwclock, ../rc6.d/K02fake-hwclock): Permission denied
insserv: can not remove(../rc6.d/K08umountroot): Permission denied
insserv: can not symlink(../init.d/umountroot, ../rc6.d/K09umountroot): Permission denied
insserv: can not remove(../rc6.d/K02sendsigs): Permission denied
insserv: can not symlink(../init.d/sendsigs, ../rc6.d/K03sendsigs): Permission denied
insserv: can not remove(../rc6.d/K04umountnfs.sh): Permission denied
insserv: can not symlink(../init.d/umountnfs.sh, ../rc6.d/K05umountnfs.sh): Permission denied
insserv: can not remove(../rc6.d/K03rsyslog): Permission denied
insserv: can not symlink(../init.d/rsyslog, ../rc6.d/K04rsyslog): Permission denied
insserv: can not remove(../rc6.d/K07umountfs): Permission denied
insserv: can not symlink(../init.d/umountfs, ../rc6.d/K08umountfs): Permission denied
insserv: can not remove(../rc6.d/K06hwclock.sh): Permission denied
insserv: can not symlink(../init.d/hwclock.sh, ../rc6.d/K07hwclock.sh): Permission denied
insserv: can not remove(../rc6.d/K01triggerhappy): Permission denied
insserv: can not symlink(../init.d/triggerhappy, ../rc6.d/K02triggerhappy): Permission denied
insserv: can not remove(../rc6.d/K01ifplugd): Permission denied
insserv: can not symlink(../init.d/ifplugd, ../rc6.d/K02ifplugd): Permission denied
insserv: can not remove(../rc6.d/K06networking): Permission denied
insserv: can not symlink(../init.d/networking, ../rc6.d/K07networking): Permission denied
insserv: can not remove(../rc6.d/K05rpcbind): Permission denied
insserv: can not symlink(../init.d/rpcbind, ../rc6.d/K06rpcbind): Permission denied
insserv: can not remove(../rc6.d/K05nfs-common): Permission denied
insserv: can not symlink(../init.d/nfs-common, ../rc6.d/K06nfs-common): Permission denied
insserv: can not remove(../rc6.d/K09reboot): Permission denied
insserv: can not symlink(../init.d/reboot, ../rc6.d/K10reboot): Permission denied
insserv: can not remove(../rc6.d/K01urandom): Permission denied
insserv: can not symlink(../init.d/urandom, ../rc6.d/K02urandom): Permission denied
insserv: can not remove(../rc6.d/K01lightdm): Permission denied
insserv: can not symlink(../init.d/lightdm, ../rc6.d/K02lightdm): Permission denied
insserv: can not remove(../rc6.d/K01alsa-utils): Permission denied
insserv: can not symlink(../init.d/alsa-utils, ../rc6.d/K02alsa-utils): Permission denied
insserv: can not symlink(../init.d/vscpd_startup_script, ../rc6.d/K01vscpd_startup_script): Permission denied
insserv: fopen(.depend.stop): Permission denied
init.d目录Script
如下:-----
#!/bin/sh
### BEGIN INIT INFO
# Provides: vscpd
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start vscpd at boot
# Description: This command is used to run daemon vscpd
### END INIT INFO
set -e
DAEMON=/usr/local/bin/vscpd
NAME=vscpd
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_begin_msg "Starting VSCP daemon: $NAME"
[ -d /var/run/vscpd ] || mkdir -p /var/run/vscpd
# start-stop-daemon --start --background -m --pidfile /var/run/vscpd.pid --exec $DAEMON && log_end_msg 0 || log_end_msg 1
start-stop-daemon --start --pidfile /var/run/vscpd.pid --exec $DAEMON && log_end_msg 0 || log_end_msg 1
;;
stop)
log_begin_msg "Stopping VSCP daemon: $NAME"
start-stop-daemon --stop --retry 15 --signal 15 --pidfile /var/run/vscpd.pid --oknodo --exec $DAEMON && log_end_msg 0 || log_end_msg 1
;;
restart)
$0 stop
$0 start
;;
reload|force-reload)
log_begin_msg "Reloading $NAME configuration files"
start-stop-daemon --stop --pidfile /var/run/vscpd.pid --signal 1 --exec $DAEMON && log_end_msg 0 || log_end_msg 1
;;
*)
log_success_msg "Usage: /etc/init.d/$NAME {start|stop|restart|reload}"
exit 1
;;
esac
exit 0
答案 0 :(得分:3)
执行update-rc.d时应该是root用户。 试试
sudo update-rc.d vscpd_startup_script defaults
代替。