|
|
|
|
||||||
| linux.debian.user debian-user@lists.debian.org. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hello,
for a home computer that gets shutdown daily, I'd like to implement a function which: 1. makes sure that all pending outgoing mails are sent off. The system uses its local exim to send mail over the (slow) net, and I don't want to pull the plug on longish emails that are being sent. Essentially the shutdown process should stop and proceed only after exim is finished with its business. Is running "exim -q" enough for that? 2. makes backups of all user home directories. For this I'd prefer the system to be in single-user mode so that no files can change dureing backup (in reality this is not so important because nobody does anything on this machine after X has shut down. While I know how to properly write an init script (I'm going to rely on the Debian policy for this) I'm unsure as to the runlevel these actions should be taken. The exim thing of course must happen before the network shuts down and the backup should be the last thing before the disks are unmounted. Suggestions, anyone? --D. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHneUxGdM4FB223AcRAmIjAJ9K2J2VGB/xbpWQpqT4q36fTuibCwCfTdm7 WHfSRJxN2Kg6XVsFjalO/t0= =cv8H -----END PGP SIGNATURE----- |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Mon, Jan 28, 2008 at 03:22:41PM +0100, Dan H. wrote:
> for a home computer that gets shutdown daily, I'd like to implement a > function which: > > 1. makes sure that all pending outgoing mails are sent off. Here's what I've come up with. Anything not to like? #!/bin/sh # install with this as root: # # update-rc.d flushmail defaults 21 19 # assuming that exim has sequence number 20 on startup and shutdown. ### BEGIN INIT INFO # Provides: flushmail # Required-Start: # Required-Stop: exim4 mail-transport-agent # Should-Start: # Default-Start: # Default-Stop: 0 1 6 # Short-Description: Flush mail queue ### END INIT INFO set -e QUEUERUNNER="/usr/sbin/runq" if [ ! -x $QUEUERUNNER ] ; then exit 1 ; fi case "$1" in start) echo "Not flushing on startup" ;; restart|stop) echo -n "Flushing mail queue..." $QUEUERUNNER echo "done." ;; esac exit 0 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFHne1ZGdM4FB223AcRArezAJ9at3+MQbIFJqenflWGyF H9X28YDgCfXl/L F+fwf6V/6WJ5zdhNCUPgq/w= =HqOd -----END PGP SIGNATURE----- |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Mon, Jan 28, 2008 at 03:57:29PM +0100, Dan H. wrote:
> On Mon, Jan 28, 2008 at 03:22:41PM +0100, Dan H. wrote: > > for a home computer that gets shutdown daily, I'd like to implement a > > function which: > > > > 1. makes sure that all pending outgoing mails are sent off. > > Here's what I've come up with. Anything not to like? > > #!/bin/sh > > # install with this as root: > # # update-rc.d flushmail defaults 21 19 > # assuming that exim has sequence number 20 on startup and shutdown. > > > ### BEGIN INIT INFO > # Provides: flushmail > # Required-Start: > # Required-Stop: exim4 mail-transport-agent > # Should-Start: > # Default-Start: > # Default-Stop: 0 1 6 > # Short-Description: Flush mail queue > ### END INIT INFO > > set -e > > QUEUERUNNER="/usr/sbin/runq" > > if [ ! -x $QUEUERUNNER ] ; then exit 1 ; fi > > case "$1" in > start) > echo "Not flushing on startup" > ;; > > restart|stop) > echo -n "Flushing mail queue..." > $QUEUERUNNER > echo "done." > ;; > esac > > exit 0 You may want to touch /etc/nologin while this happens, then remove it at the end of the script. It can also include the backup scripts he wishes. Doug. -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org |
|
![]() |
| Outils de la discussion | |
|
|