1 |
On 05/26/2010 12:30 AM, Allan Gottlieb wrote: |
2 |
> For quite a while I have used the following steps to perform a |
3 |
> "single-user backup" |
4 |
> |
5 |
> 1. Boot to single user mode via the grub command |
6 |
> kernel /boot/vmlinuz root=/dev/sda6 single |
7 |
> |
8 |
> 2. Type in the root password. |
9 |
> |
10 |
> 3. Execute a single command |
11 |
> /usr/local/sbin/ajg-backup-init-3 |
12 |
> which does the backup and then executes |
13 |
> init 3 |
14 |
> |
15 |
> 4. This gets me to multi-user mode. |
16 |
> |
17 |
> I would like to automate this so that booting directly to multi-user |
18 |
> mode via |
19 |
> kernel /boot/vmlinuz root=/dev/sda6 |
20 |
> |
21 |
> All I need to do is to execute the single command |
22 |
> /usr/local/sbin/ajg-backup-init-3 |
23 |
> at the right moment. |
24 |
> This didn't seem hard; I want it after everything in boot but before |
25 |
> everything currently in default. So I was going to put it in |
26 |
> default with a "before *" in depend() |
27 |
> |
28 |
> Reading the gentoo handbook chapter B4.d "Writing Init Scripts" |
29 |
> I find two comments criticizing this approach |
30 |
> |
31 |
> 1. "You can also use the "*" glob [argument to before] to catch all |
32 |
> services in the same runlevel, although this isn't advisable". |
33 |
> |
34 |
> 2. "Note: Make sure that --exec actually calls a service and not just a |
35 |
> shell script that launches services and exits -- that's what the |
36 |
> init script is supposed to do." |
37 |
> |
38 |
> I can see problems with multiple "before *" directives, but no other |
39 |
> script has one so I think I would be OK with my "before *". |
40 |
> |
41 |
> Criticism 2 has me concerned since my backup routing is indeed a shell |
42 |
> script that exits. Indeed, my backup is not really a service so I am |
43 |
> worried that I shouldn't be using an initscript at all. |
44 |
> |
45 |
> Any advice/comments would be welcome. |
46 |
> |
47 |
> thanks, |
48 |
> allan |
49 |
> |
50 |
> |
51 |
You could create a LVM-snapshot of the partition/data you wish to backup |
52 |
at "before *" or inside "boot" and then later run the backup on the |
53 |
mounted snapshot, removing it afterwards. |
54 |
|
55 |
Bye, |
56 |
Daniel |
57 |
|
58 |
-- |
59 |
PGP key @ http://pgpkeys.pca.dfn.de/pks/lookup?search=0xBB9D4887&op=get |
60 |
# gpg --recv-keys --keyserver hkp://subkeys.pgp.net 0xBB9D4887 |