Monday 29 April 2019

debian - Why would a shutdown script NOT run?

I have installed a shutdown script on an Ubuntu system which doesn't get executed. It is an Amazon EC2 instance. I'm not sure it has to do with this fact just wanted to point it out.


The script should push some log files to an Amazon S3 bucket so it has to be executed while networking is up.


Here is how I installed the script:


1) Created the file in /etc/init.d/push-apache-logs-to-s3.sh with the required commands.


2) Made it executable with sudo chmod +x push-apache-logs-to-s3.sh


3) Executed sudo update-rc.d push-apache-logs-to-s3.sh start 0 0 .


Output from the above was:


update-rc.d: warning: /etc/init.d/push-apache-logs-to-s3.sh missing LSB information
update-rc.d: see
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

The contents of /etc/rc0.d/ is now:


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

When I manually execute the script with sudo ./push-apache-logs-to-s3.sh, it does the intended job.


Are these scripts executed by root? What am I missing?

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...