0 0 * * 0 /usr/bin/mysqldump -uroot -p'PASS' DBName > /path/DB_backup/$(date +\%Y-\%m-\%d_\%Hh\%M).sql
example output file:
2011-02-06_00h00.sql
Monday, February 7, 2011
Wednesday, September 15, 2010
Sym Link to multiple CIFS mounts
A simple script that creates sym links to multiple cifs mounts and dumps them into a master folder.
#!/bin/bash
DIR="/media/MDrive/"
DIR2="/media/ZDrive/"
DIR3="$DIR $DIR2"
DIR4="masterDownloads"
#echo $DIR3
IFS=$'\n'
#for i in $(find $DIR -type f -printf "%f\n")
for i in $(find $DIR -type f)
do
echo "Processing... $i"
mkdir -p ./$DIR4/$(dirname $i)
ln -s $i ./$DIR4$i
clear
done
Thursday, July 22, 2010
Wednesday, July 7, 2010
data integrity check from CSV
To test the data integrity in your CSV file and locate any lines that contain the delimiter in the data field so that it can be removed manually.
Regular Expression:
/(?:.*?\|){4,}.*/
Will select lines that contain 4 or more pipes per line.
(?: ) is a non-capturing group. Similar to ( ), except that it doesn't store the result for later reference.
A more greedy approach is to write something like this:
/^(?:[^|]*\|){4}[^|]*$/
This will match lines that contain only four pipes
Test it:
http://rubular.com/r/f7Vd9O1c4k
Or using ruby one-liners:
#print only lines that match a regular expression (emulates 'grep')
$ ruby -pe 'next unless $_ =~ /regexp/' < file.txt
#print only lines that DO NOT match a regular expression (emulates 'grep')
$ ruby -pe 'next if $_ =~ /regexp/' < file.txt
Regular Expression:
/(?:.*?\|){4,}.*/
Will select lines that contain 4 or more pipes per line.
(?: ) is a non-capturing group. Similar to ( ), except that it doesn't store the result for later reference.
A more greedy approach is to write something like this:
/^(?:[^|]*\|){4}[^|]*$/
This will match lines that contain only four pipes
Test it:
http://rubular.com/r/f7Vd9O1c4k
Or using ruby one-liners:
#print only lines that match a regular expression (emulates 'grep')
$ ruby -pe 'next unless $_ =~ /regexp/' < file.txt
#print only lines that DO NOT match a regular expression (emulates 'grep')
$ ruby -pe 'next if $_ =~ /regexp/' < file.txt
Saturday, May 24, 2008
How to setup local Yum repository in Fedora 8
The advantage of running a local repository is to save bandwidth. With this method you can distribute RPMs across your network from a central server and only worry about keeping your server in sync with the other Fedora mirrors.
1) Install Apache web server:
2) Install a tool to index your repo:
3) Now is the time to download the Fedora repository. If you have the install DVD you can copy the contents from there, however it only contains a limited set of packages. If you want everything then download it from a good mirror server.
In this case I used rsync but you can also use http or ftp protocol and download using wget command.
The RPMs will be located in your apache web root folder /var/www/html/yum/base/8/i386
4) Index the repo:
5) Now we need to tell yum to use the local repo. Edit the yum.conf file:
[base-local]
name=Fedora 8 - i386
failovermethod=priority
baseurl=http:///yum/base/$releasever/$basearch
enabled=1
gpgcheck=0
6) To confirm that we have everything setup run these commands:
output:
base-local is enabled and we can now start using it.
Lists all imported packages on the local repo.
Installs liferea from the local repo. Note that if you don't disable the internet repo and yum finds a later version of liferea online it will try to download that instead.
1) Install Apache web server:
yum install httpd and start it: /etc/init.d/httpd start2) Install a tool to index your repo:
yum install createrepo3) Now is the time to download the Fedora repository. If you have the install DVD you can copy the contents from there, however it only contains a limited set of packages. If you want everything then download it from a good mirror server.
In this case I used rsync but you can also use http or ftp protocol and download using wget command.
rsync -avrt rsync://rsync.muug.mb.ca/fedora-enchilada/linux/releases/8/Everything/i386/os/Packages/ /var/www/html/yum/base/8/i386
The RPMs will be located in your apache web root folder /var/www/html/yum/base/8/i386
4) Index the repo:
createrepo /var/www/html/yum/base/8/i3865) Now we need to tell yum to use the local repo. Edit the yum.conf file:
nano /etc/yum.conf and append this information:[base-local]
name=Fedora 8 - i386
failovermethod=priority
baseurl=http://
enabled=1
gpgcheck=0
6) To confirm that we have everything setup run these commands:
yum repolistoutput:
repo id repo name status
base-local Fedora 8 - i386 enabled
fedora Fedora 8 - i386 enabled
livna Livna for Fedora Core 8 - i386 - Base enabled
updates Fedora 8 - i386 - Updates enabled
base-local is enabled and we can now start using it.
Lists all imported packages on the local repo.
yum list all --disablerepo=fedora,updates,livnaInstalls liferea from the local repo. Note that if you don't disable the internet repo and yum finds a later version of liferea online it will try to download that instead.
yum install liferea --disablerepo=fedora,updates,livna
Subscribe to:
Posts (Atom)