Featured

Linux Cloud Technologies 2013

  Build the cloud on Linux!  This year looks very promising for Linux when it comes to building your private cloud using open source technologies.  Finally, Linux-based software and application

Read More
Linux Cloud Technologies 2013

SQL Server insert with sub queries

0
by on July 9, 2013 at 1:51 pm

Extremely awesome SQL query I wrote.


use my_db

INSERT INTO
 dbo.my_archive

select
ltrim(rtrim(str(b.my_id)))+ltrim(rtrim(str(b.date))) pid_date,
b.my_id,
b.date,
p.column1+p.column2 ssdd,
p.last_name,
p.first_name,
COUNT (*) Amount,
(
select COUNT(*) from amounts b1
where b1.flags = '1'
and b1.my_id = b.my_id
and b1.date = b.date
) Deleted,
(
select SUM(m.count1)
from mail_counts m
where m.my_id = b.my_id
and m.date = b.date
) Counts

 from amounts b

inner join pusers p
on b.my_id = p.my_id

where (b.date < '20130701' and b.date >= '20120101')
and not exists (
select *
FROM dbo.my_archive mt
where mt.pid_date = ltrim(rtrim(str(b.my_id)))+ltrim(rtrim(str(b.date)))
)
and p.column1 != 'TS'

group by b.date, b.my_id, p.first_name, p.last_name, p.column1+p.column2

in Uncategorized

,

Ajax script with python backend

0
by on June 10, 2013 at 3:07 pm

At my day job, I’m a Linux System Administrator.  This roughly translates to “Everything System Administrator” as I work in a lot of other capacities as well.  One of my duties is maintaining an internal web portal that runs on a RHEL 6 system.  A good portion of our portal runs on Python and Perl CGI scripts.  I wanted to dynamically update part of a page and I needed to make an Ajax call to a Python script instead of a normal PHP or ASP (etc).  I ran into a problem with a not so obvious solution compared to how people make calls to PHP backends.

(more…)

in How-To

, , , , ,

Ad goes here

Python Backup Script

0
by on February 21, 2013 at 10:23 pm

Part one, take the first full backup. At the present time, this code is still under development and should not be used on a production machine. However, I am posting it here for reference.

Eventually, this code is going to be included in a backup client I am developing that will interface with glusterfs and Amazon S3 storage.

Currently, this code is tested to run on Python v2.7.4 on a Fedora 18 machine. With all three python files, and any number of properly defined job xml files in the jobs.d/ directory, these scripts are currently functional.

(more…)

in Uncategorized

, , , ,

Start iptables in Debian Automatically

5
by on February 21, 2013 at 9:47 pm

If you are trying to make iptables survive a reboot in Debian Squeeze or Wheezy, you may find the following of use.  After you get your iptables all squared away, save them to a text file with the incredibly handy /sbin/iptables-save command:

/sbin/iptables-save > /root/iptables.saved

This will create a text file in the /root directory containing lines that will be parsed by iptables when used with the  iptables-restore command.

Next, add the following script to your system:

(more…)

in Debian, How-To

, , , ,

Backup MySQL database

0
by on January 16, 2013 at 6:44 pm

Today, we’re going to be covering the 3 most important rules for any Linux System Administrator:  Backups, Backups, Backups.

That’s right, if you don’t have backups, you have failed in your duties.  Every single thing else you may have done to secure your system cannot replace the need for backups.  Systems get cracked, hard drives fail, CPUs fail, RAM fails, password are forgotten, files get rm’d by mistake, patches break systems.

This article is about creating a simple backup script to backup your MySQL databases to an offsite location, complete with cron jobs, and encryption.

(more…)

, , , ,

Categories