Find the answer to your Linux question:
Results 1 to 6 of 6
Hi, I have a server that I want to run an automatic backup ever 48 hours by mounting a network server with smbmount as /mnt/backup, copying everything in /home/httpd (which ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Feb 2004
    Posts
    139

    Backup script


    Hi,

    I have a server that I want to run an automatic backup ever 48 hours by mounting a network server with smbmount as /mnt/backup, copying everything in /home/httpd (which can get up to 40GB), and unmounting the network server. It would probobly be ideal to run this is a cron, but I have no idea how...I have never done a cronjob with all this stuff. For smbmount, I would also have to enter password and don't know how to include that into the script.

    That would do all of the httpdocs, but is there a way to also export all of the MySQL databases into a .sql file for each database onto the network server?

    Thanks for any help.
    If you love something, emerge it

  2. #2
    Linux Newbie
    Join Date
    May 2004
    Location
    Boston, MA
    Posts
    246
    In order to make the backup run every 48 hours, all I can think of is to have a link to your script in /etc/cron.daily and have the script refer to a file that either exists or doesn't exist. If it exists, the backup runs and your script deletes the file; if it doesn't exist, the backup doesn't run and creates the file. This or some variation on it might work.

    For smbmount, you can either use
    Code:
    smbmount username=jtravolta,password=swordfish
    or, if you don't want this information in the script,
    Code:
    smbmount credentials=/root/balderdash
    where /root/balderdash is a file that looks like
    Code:
    username = jtravolta
    password = swordfish
    Make sure that file is readable only by root though.

    I don't know about mysql, but I hope I've helped you some.
    Situations arise because of the weather,
    And no kinds of love are better than others.

  3. #3
    Just Joined!
    Join Date
    Jul 2004
    Location
    Wherever the beautiful women are.
    Posts
    99
    I don't know much about cronjobs, but I've found the HOWTOs and FAQs in the /usr/doc folder (might vary on your installation) incredibly useful. If the post above this doesn't help maybe you'll find something there.

  4. #4
    Linux Newbie
    Join Date
    Feb 2004
    Posts
    139
    The following is the command (well sort of) I use to mount the backup server:
    Code:
    smbmount //12.34.56.78/username /mnt/backup -o username=username
    What happens once I put that in is it asks me for my password, and I type that in, then it mounts. I got the command just fine, however, how do I tell the script to put in a password when prompted for it?

    I guess it isnt all too bad if I just manually mount it and keep it mounted and just run something to copy everything from the /home/httpd to /mnt/backup and overwrite old files?
    If you love something, emerge it

  5. #5
    Linux Newbie
    Join Date
    May 2004
    Location
    Boston, MA
    Posts
    246
    Are you saying that
    Code:
    smbmount //12.34.56.78/username /mnt/backup -o username=username,password=password
    and
    Code:
    smbmount //12.34.56.78/username /mnt/backup -o credentials=credfile
    don't work? If that's the case, I don't know how else to do it.

  6. #6
    Linux Engineer
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    796
    The mount command should work..

    Code:
    smbmount //12.34.56.78/username /mnt/backup -o username=username,password=password
    If you are using a domain envirnment you sometimes have to include ,workgroup=YOURWORKGROUP after the password to tells smbmount to authenticate against a the domain controller.

    For the mysql database data you can use mysqldump for dumping out the complete datastructure including the data to a sql file. Like this

    Code:
    mysqldump <databasename> -u <dbuser> --password=<dbpassword> > mysql-backup-test.sql
    If you dont feel up for programming this by your self, my product Andutteye Surveillance have predefined plugins for it, and much more.

    Let us know if it still dont workes
    Regards

    Andutt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •