Bash script to Backup Android SD Card

I just created simple bash script to backup my android sd card phone, you can freely used it with the adjustment according to your phone setting and files you want backup.

#!/bin/bash
# author : rachmat.febrianto@gmail.com
# script to backup content : images and e-book of sdcard 
# for android mobile phone

prog=phone_backup.sh
bkp_source1=DCIM
bkp_source2=e-book
bkp_target=/home/rachmat/backup/`date +%y-%m-%d`
sdcard_dir=/mnt/sdcard
sdcard_dev=/dev/sdd1

function check_dir_dev(){
	echo "Checking existance of $sdcard_dir directory ..."
	if [ -d $sdcard_dir ]; then
		echo "The $sdcard_dir directory exist"
		echo ""
	else
		echo "The $sdcard_dir directory doesn't exist"
		echo "Creating $sdcard_dir directory ..."
		echo ""
		mkdir $sdcard_dir
	fi

	echo "Checking existance of $sdcard_dev block special device ..."
	if [ -e $sdcard ]; then
 		echo "the $sdcard_dev block special device exist"
		echo ""
		mounting
		backup
	else
		echo "the $sdcard_dev block special device doesn't exist"
		echo "please consult to your administrator."	
		echo ""
	exit 1;
	fi
}

function mounting(){
	mount $sdcard_dev $sdcard_dir
	if [ $? == 0 ]; then
		echo "$sdcard_dev mounted on $sdcard_dir"
	else
		echo "Error with error code $?"
	fi
}

function backup(){
	echo "Backup start, please wait for a while ..."
	mkdir $bkp_target
	cp -r $sdcard_dir/$bkp_source1 $bkp_target
	cp -r $sdcard_dir/$bkp_source2 $bkp_target
	chown -R rachmat:rachmat $bkp_target
	umount $sdcard_dir
	echo "Backup finish, please check $bkp_target directory"
}

case "$1" in 
	backup)
		check_dir_dev;;
	*)	echo "usage: $prog {backup}"
esac

Installing Cacti On Oracle Linux

cacti

Just test and installing Cacti on Oracle Linux 6.4
Before you go ahead installing cacti on your linux distrubition, there are some requirement to fullfill.

Cacti required :
1. AMP : Apache, Mysql, PHP
2. Some packages : RRDTool, net-snmp

Assumming your AMP is running, and we can go ahead to next steps.

1. Downloding latest cacti
http://www.cacti.net/download_cacti.php

2. Extract it into your http web folder, in linux tipically : /var/www/html

3. prepare database to be used by cacti:
– login mysql and create database and cacti user and grant it with following sql command:

CREATE USER 'cacti'@'localhost' IDENTIFIED BY '***';GRANT USAGE ON *.* TO 'cacti'@'localhost' IDENTIFIED BY '***' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;CREATE DATABASE IF NOT EXISTS `cacti`;

 

GRANT ALL PRIVILEGES ON `cacti`.* TO 'cacti'@'localhost';

4. Import default cacti database with cacti.sql
you can get file “cacti.sql” inside your cacti folder that you just extracted.

[root@localhost cacti]# pwd
/var/www/html/cacti
[root@localhost cacti]# ls -l cacti.sql
-rw-r--r-- 1 1000 users 178349 Aug  7 09:31 cacti.sql
[root@localhost cacti]#
[root@localhost cacti]# mysql -u root -p cacti < cacti.sql

5. Open your browser to install cacti. http://localhost/cacti
and follow the instruction.

Screenshot

viola.. installation is done. now you can login with default usernam and password :
username : admin
password : admin

Enable anonymous ftp on Solaris 10

astrounaut_cat

Here the simple step to enable anonymous ftp on Solaris 10:

# ftpconfig -d /export/home/ftp_anonymous
Creating directory /export/home/ftp_anonymous
Updating directory /export/home/ftp_anonymous

# ls /export/home/ftp_anonymous
bin  dev  etc  lib  pub  usr

# ftpconfig /export/home/ftp_anonymous
Creating user ftp
Updating directory /export/home/ftp_anonymous

# svcadm enable svc:/network/ftp:default

# svcs -a | grep ftp
online         18:30:19 svc:/network/ftp:default

Testing from client side:

$ ftp 192.168.56.10
Connected to 192.168.56.10 (192.168.56.10).
220 solaris FTP server ready.
Name (192.168.56.10:rachmat): anonymous
331 Guest login ok, send your complete e-mail address as password.
Password:
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir
227 Entering Passive Mode (192,168,56,10,251,189)
150 Opening ASCII mode data connection for /bin/ls.
total 16
lrwxrwxrwx   1 root     bin            9 Oct 19 18:29 bin -> ./usr/bin
d--x--x--x   2 root     sys            7 Oct 19 18:29 dev
d--x--x--x   5 root     sys            8 Oct 19 18:29 etc
d--x--x--x   2 root     bin           23 Oct 19 18:29 lib
drwxr-xr-x   2 root     sys            2 Oct 19 18:24 pub
d--x--x--x   6 root     sys            6 Oct 19 18:24 usr
226 Transfer complete.
ftp> bye
221-You have transferred 0 bytes in 0 files.
221-Total traffic for this session was 780 bytes in 1 transfers.
221-Thank you for using the FTP service on solaris.
221 Goodbye.