Friday, March 13, 2015

Bath download photos

First install tgrab by pip:

# apt-get update
# apt-get install python-pip
# pip install tgrab

Then create a script to run it in bath:


# Working Folder

# Array storage the tumblr accounts:
# Example: cars for
array=( cars computerhistorymuseum computer macdesks )

for i in "${array[@]}"
echo "*****$i*****"
mkdir -p $WORK_DIR/$i
cd $WORK_DIR/$i
ls|wc -l
tgrab -n $i -p 100 > download.log 2>&1 &


The script will go through the array then download all photos for the first 100 pages back.
Each tgrab job will running at background, the downloads will be under each folder.

Appreciate the works on tgrab.
And Pythong Rocks!

Move Rebuild the Gitolite server

Here is how I moved or rebuild the gitolite server.

My old gitolite version is 1.x.
Mark IP:[]
Clone your old gitolite-admin repo to somewhere.

The new gitolite I install on Debian 7 Wheezy through backports.
Mark IP:[]

  1. Make sure generate ssh key before you install gitolite3.

  2. Install gitolite3.

  3. # apt-get update
    # apt-get install gitolite3

    It will asking you for the public key.

  4. Clone the gitolite-admin somewhere.

  5. # git clone gitolite3@

  6. copy the gitolite-adminconfgitolite.conf from old gitolite-admin repo to new gitolite-admin repo.

  7. Be careful of the admin for repo gitolite-admin.
    Make sure you have the key for the permission.

  8. copy the keys gitolite-adminkeydir* from old gitolite-admin repo to new gitolite-admin repo.

  9. copy all the repos from the old server to new server into a temp folder:.

  10. # scp -r root@ /tmp

  11. Drop the gitolite-admin and any other retired repo, then move them into the new gitolite3 repository folder:.

  12. # rm -rf /tmp/repositories/gitolite-admin.git/
    # rm -rf /tmp/repositories/testing.git/

    # mv /tmp/repositories/* /var/lib/gitolite3/repositories/

  13. Make sure the files end up with the right ownership and permissions; if not, chown/chmod them..

  14. I found most easy way to do it run scp by gitolite3 user.

  15. Push the changes on the new gitolite-admin repo:.

  16. # git add keydir/
    # git commit -a
    # git push

    And you are all set.

Friday, March 6, 2015

Redmine Log rotation

Just upgrade to Redmine 3.0.0
Finds of that the Log rotation and level did not work anymore.

I tried both old and new way:

The old config:

config.logger =, 7, 1024000)
config.logger.level = Logger::WARN

The new config:

config.log_level = :warn

I have to use logrotate at the end:

Here is my config file:

/var/www/redmine-3.0.0/log/production.log {
su www-data www-data
rotate 7

To test run:

logrotate --force /etc/logrotate.d/redmine