Question

Can I warn users when the droplet is being restored?

Posted August 28, 2014 1.9k views

Is there some event I can hook into / listen for, like an Upstart event for ACPI poweroff, to broadcast a wall when the system is going down for restore?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Callbacks can be done a number of ways, but it is very trivial to add a script to fire on a specific runlevel. For instance, in Ubuntu, you have the following [http://en.wikipedia.org/wiki/Runlevel#Ubuntu](http:// “Link title”)

A simple solution, would be to install / configure “postfix” and have a bash script run the ‘mail’ command found in the mail-utils package. If you’re going to power off the machine, you can place the script in /etc/rc0.d/ This of course, is run-level 0 or “halt”. If you do an 'ls -lt’ in that directory, you’ll notice that there are symlinks:

ls -lt
total 4.0K
lrwxrwxrwx 1 root root  17 Aug 26 13:28 K09apache2 -> ../init.d/apache2*
lrwxrwxrwx 1 root root  18 Aug  5 16:54 K79quotarpc -> ../init.d/quotarpc*
lrwxrwxrwx 1 root root  15 Aug  5 16:54 K85quota -> ../init.d/quota*
lrwxrwxrwx 1 root root  17 Jul  9 13:42 K08tomcat7 -> ../init.d/tomcat7*
lrwxrwxrwx 1 root root  20 May 20 12:39 K20virtualbox -> ../init.d/virtualbox*
lrwxrwxrwx 1 root root  29 May 20 12:31 K10unattended-upgrades -> ../init.d/unattended-upgrades*
lrwxrwxrwx 1 root root  20 May 20 12:23 S35networking -> ../init.d/networking*
lrwxrwxrwx 1 root root  18 May 20 12:23 S20sendsigs -> ../init.d/sendsigs*
lrwxrwxrwx 1 root root  22 May 20 12:23 S31umountnfs.sh -> ../init.d/umountnfs.sh*
lrwxrwxrwx 1 root root  18 May 20 12:23 S40umountfs -> ../init.d/umountfs*
lrwxrwxrwx 1 root root  20 May 20 12:23 S60umountroot -> ../init.d/umountroot*
lrwxrwxrwx 1 root root  14 May 20 12:23 S90halt -> ../init.d/halt*
lrwxrwxrwx 1 root root  17 May 20 12:23 S30urandom -> ../init.d/urandom*
-rw-r--r-- 1 root root 353 Jul 26  2012 README

What I would do, is find a logical place to store your callback script and symlink it here.

-Johnny Starr
[www.thestarrlab.com](http:// “The StarrLab”)

Submit an Answer