我在未执行的 Ubuntu 系统上安装了关闭脚本。它是一个 Amazon EC2 实例。我不确定这与这个事实有关,只是想指出这一点。
该脚本应将一些日志文件推送到 Amazon S3 存储桶,因此必须在网络启动时执行它。
这是我安装脚本的方式:
1)/etc/init.d/push-apache-logs-to-s3.sh
使用所需的命令创建文件。
2)使其可执行sudo chmod +x push-apache-logs-to-s3.sh
3) 执行sudo update-rc.d push-apache-logs-to-s3.sh start 0 0 .
上面的输出是:
update-rc.d: warning: /etc/init.d/push-apache-logs-to-s3.sh missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
Adding system startup for /etc/init.d/push-apache-logs-to-s3.sh ...
/etc/rc0.d/S00push-apache-logs-to-s3.sh -> ../init.d/push-apache-logs-to-s3.sh
现在的内容/etc/rc0.d/
是:
lrwxrwxrwx 1 root root 17 Jul 31 2012 K09apache2 -> ../init.d/apache2
lrwxrwxrwx 1 root root 29 Jun 16 2012 K10unattended-upgrades -> ../init.d/unattended-upgrades
lrwxrwxrwx 1 root root 26 Jun 16 2012 K15landscape-client -> ../init.d/landscape-client
lrwxrwxrwx 1 root root 19 Apr 10 11:11 K20memcached -> ../init.d/memcached
-rw-r--r-- 1 root root 353 Jul 26 2012 README
lrwxrwxrwx 1 root root 35 Jul 10 12:01 S00push-apache-logs-to-s3.sh -> ../init.d/push-apache-logs-to-s3.sh
lrwxrwxrwx 1 root root 18 Jun 16 2012 S20sendsigs -> ../init.d/sendsigs
lrwxrwxrwx 1 root root 17 Jun 16 2012 S30urandom -> ../init.d/urandom
lrwxrwxrwx 1 root root 22 Jun 16 2012 S31umountnfs.sh -> ../init.d/umountnfs.sh
lrwxrwxrwx 1 root root 20 Jun 16 2012 S35networking -> ../init.d/networking
lrwxrwxrwx 1 root root 18 Jun 16 2012 S40umountfs -> ../init.d/umountfs
lrwxrwxrwx 1 root root 20 Jun 16 2012 S60umountroot -> ../init.d/umountroot
lrwxrwxrwx 1 root root 14 Jun 16 2012 S90halt -> ../init.d/halt
当我使用 手动执行脚本时sudo ./push-apache-logs-to-s3.sh
,它会完成预期的工作。
这些脚本是由 执行的root
吗?我错过了什么?