Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Re: Setting a Backup Command



[Tobias Diedrich ([tlug] Re: Setting a Backup Command) writes:]
>> Charles Muller wrote:
>> > I would like to save this in a file that I can run as a command, like a
>> > BAT file in DOS. I assume then, that I would save this script in a text
>> > file. Then, what else should I do, in terms of naming, or other
>> > preparation, to have this file available as a command?
>> 
>> In *nix, if a text file starts with
>> #!foo bar
>> at the first line and is executable, the os will search for foo,
>> execute it with the parameters bar and feed it this file as input.

Just expanding this a little for Chuck....

To make a file "executable", you run "chmod +x file-name". This turns
any text file into the equivalent of a DOS BAT file.

>> e.g.
>> 
>> #!/bin/sh
>> echo Hello world !
>> 
>> is what you are probably looking for :-)

So you'd replace the "echo ..." with "tar czf ...."
 
>> If you really do your backup daily, you probably also want to automate
>> it with cron (man crontab).

Yes, read the crontab man page.

To give some background, cron is a daemon (resident program) which
executes scheduled commands. crontab is the program that lets users
maintain the crontab files (yes, it's confusing having the files and the
program share a name).

In my crontab I have:

0 5 * * * /home/haru_bak/buscript

which means every day at 5am the "buscript" file is executed.

"buscript" contains, among other things, the tar command creating
a daily backup.

HTH

Jim

-- 
Jim Breen  [j.breen@example.com  http://www.csse.monash.edu.au/~jwb/]
Computer Science & Software Engineering,                Tel: +61 3 9905 3298
P.O Box 26, Monash University,                          Fax: +61 3 9905 5146
Clayton VIC 3800, Australia      ジム・ブリーン@モナシュ大学

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links