2
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 <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
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?
1This sort of problems are usually caused by something missing from the environment variables when run non-interactively. I assume you took the precaution to not use relative paths on your scripts so maybe a dependence on an environment variable that isn't available. Could you add the script to your question? – GnP – 2013-07-10T13:42:45.533
@gnp I posted another question about this with more details and the script contents. Please check it here: http://superuser.com/questions/617957/lsb-init-script-not-executed
– marekful – 2013-07-10T13:51:50.977I think I now what's wrong.
s3cmd
was configured under another user notroot
thus the init script which is run byroot
fails to execute thes3cmd
command. I'll try configuring it under the root user and see if that helps. – marekful – 2013-07-10T13:58:55.747Nope, that didn't help. When I execute the script with either user, it is doing what it should so
s3cmd
CAN access its configuration. Still, apparently the init script is not executed at shutdown... – marekful – 2013-07-10T14:04:34.053