FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 05-25-2010, 10:30 PM
Allan Gottlieb
 
Default Performing a backup during the boot sequence

For quite a while I have used the following steps to perform a
"single-user backup"

1. Boot to single user mode via the grub command
kernel /boot/vmlinuz root=/dev/sda6 single

2. Type in the root password.

3. Execute a single command
/usr/local/sbin/ajg-backup-init-3
which does the backup and then executes
init 3

4. This gets me to multi-user mode.

I would like to automate this so that booting directly to multi-user
mode via
kernel /boot/vmlinuz root=/dev/sda6

All I need to do is to execute the single command
/usr/local/sbin/ajg-backup-init-3
at the right moment.
This didn't seem hard; I want it after everything in boot but before
everything currently in default. So I was going to put it in
default with a "before *" in depend()

Reading the gentoo handbook chapter B4.d "Writing Init Scripts"
I find two comments criticizing this approach

1. "You can also use the "*" glob [argument to before] to catch all
services in the same runlevel, although this isn't advisable".

2. "Note: Make sure that --exec actually calls a service and not just a
shell script that launches services and exits -- that's what the
init script is supposed to do."

I can see problems with multiple "before *" directives, but no other
script has one so I think I would be OK with my "before *".

Criticism 2 has me concerned since my backup routing is indeed a shell
script that exits. Indeed, my backup is not really a service so I am
worried that I shouldn't be using an initscript at all.

Any advice/comments would be welcome.

thanks,
allan
 
Old 05-26-2010, 03:17 PM
Daniel Troeder
 
Default Performing a backup during the boot sequence

On 05/26/2010 12:30 AM, Allan Gottlieb wrote:
> For quite a while I have used the following steps to perform a
> "single-user backup"
>
> 1. Boot to single user mode via the grub command
> kernel /boot/vmlinuz root=/dev/sda6 single
>
> 2. Type in the root password.
>
> 3. Execute a single command
> /usr/local/sbin/ajg-backup-init-3
> which does the backup and then executes
> init 3
>
> 4. This gets me to multi-user mode.
>
> I would like to automate this so that booting directly to multi-user
> mode via
> kernel /boot/vmlinuz root=/dev/sda6
>
> All I need to do is to execute the single command
> /usr/local/sbin/ajg-backup-init-3
> at the right moment.
> This didn't seem hard; I want it after everything in boot but before
> everything currently in default. So I was going to put it in
> default with a "before *" in depend()
>
> Reading the gentoo handbook chapter B4.d "Writing Init Scripts"
> I find two comments criticizing this approach
>
> 1. "You can also use the "*" glob [argument to before] to catch all
> services in the same runlevel, although this isn't advisable".
>
> 2. "Note: Make sure that --exec actually calls a service and not just a
> shell script that launches services and exits -- that's what the
> init script is supposed to do."
>
> I can see problems with multiple "before *" directives, but no other
> script has one so I think I would be OK with my "before *".
>
> Criticism 2 has me concerned since my backup routing is indeed a shell
> script that exits. Indeed, my backup is not really a service so I am
> worried that I shouldn't be using an initscript at all.
>
> Any advice/comments would be welcome.
>
> thanks,
> allan
>
>
You could create a LVM-snapshot of the partition/data you wish to backup
at "before *" or inside "boot" and then later run the backup on the
mounted snapshot, removing it afterwards.

Bye,
Daniel

--
PGP key @ http://pgpkeys.pca.dfn.de/pks/lookup?search=0xBB9D4887&op=get
# gpg --recv-keys --keyserver hkp://subkeys.pgp.net 0xBB9D4887
 
Old 05-26-2010, 04:38 PM
Allan Gottlieb
 
Default Performing a backup during the boot sequence

At Wed, 26 May 2010 17:17:45 +0200 Daniel Troeder <daniel@admin-box.com> wrote:

> On 05/26/2010 12:30 AM, Allan Gottlieb wrote:
>> For quite a while I have used the following steps to perform a
>> "single-user backup"
>>
>> 1. Boot to single user mode via the grub command
>> kernel /boot/vmlinuz root=/dev/sda6 single
>>
>> 2. Type in the root password.
>>
>> 3. Execute a single command
>> /usr/local/sbin/ajg-backup-init-3
>> which does the backup and then executes
>> init 3
>>
>> 4. This gets me to multi-user mode.
>>
>> I would like to automate this so that booting directly to multi-user
>> mode via
>> kernel /boot/vmlinuz root=/dev/sda6
>>
>> All I need to do is to execute the single command
>> /usr/local/sbin/ajg-backup-init-3
>> at the right moment.
>> This didn't seem hard; I want it after everything in boot but before
>> everything currently in default. So I was going to put it in
>> default with a "before *" in depend()
>>
>> Reading the gentoo handbook chapter B4.d "Writing Init Scripts"
>> I find two comments criticizing this approach
>>
>> 1. "You can also use the "*" glob [argument to before] to catch all
>> services in the same runlevel, although this isn't advisable".
>>
>> 2. "Note: Make sure that --exec actually calls a service and not just a
>> shell script that launches services and exits -- that's what the
>> init script is supposed to do."
>>
>> I can see problems with multiple "before *" directives, but no other
>> script has one so I think I would be OK with my "before *".
>>
>> Criticism 2 has me concerned since my backup routing is indeed a shell
>> script that exits. Indeed, my backup is not really a service so I am
>> worried that I shouldn't be using an initscript at all.
>>
>> Any advice/comments would be welcome.
>>
> You could create a LVM-snapshot of the partition/data you wish to backup
> at "before *" or inside "boot" and then later run the backup on the
> mounted snapshot, removing it afterwards.

Thanks, but I am not trying to minimize the boot time. The disk to disk
dumps are fast enough (I do the slower copy to a remote site after
logged in). I am just trying to have the dump done at the right point
in the boot sequence without manually going into single user mode. If I
could automate the snapshot, I could automate the dump.

Indeed rereading the gentoo manual, I see that the requirement that you
invoke a service and not a script that exits, applies only to
start-stop-daemon, so I will just try to invoke my script directly from
the init script.

allan
 

Thread Tools




All times are GMT. The time now is 10:18 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org