Blog



Create User To Mysql and Ubuntu

E-mail Print PDF

Creating users is routine job generally used everyday. How to memorize those commands is important to for private server administrator, like me :)

MySQL:

create a user name is gamestore and password is ****

1
CREATE USER 'gamestore'@'localhost' IDENTIFIED BY '****';

Then offer this user special security level to access to assigned database, for example:osc_sea_glenn_2030

1
GRANT ALL ON osc_sea_glenn_2030.* TO gamestore@localhost IDENTIFIED '****';

if you want to remotely access to mysql database, change above to:

1
GRANT ALL ON osc_sea_glenn_2030.* TO gamestore@'%' IDENTIFIED '****';

In addition to do that, we have to add or modify the line in  "/etc/mysql/my.cnf" to "bind_server: 200.39.29.12", if the server public ip is 200.39.29.12.

 

Ubuntu(Linux):

That will be pretty simple to add a system user in terminal:

1
2
sudo useradd -d /home/testuser -m testuser
sudo passwd testuser
Last Updated ( Friday, 16 July 2010 18:50 )
 

Backup and Restore Ubuntu System

E-mail Print PDF

Backup:

There are many out-of-box tools for windows backup, for example: Ghost. How about Linux? You could choose some tools for the same purpose, like linuxImager which force you to use floppy disk as start point. What if we don't want to use any third party software. Basically we can do it simply by "tar" command in ubuntu. Login as "root" in your ubuntu server. execute following commands:

1
2
cd /
tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /

It will create backup.tgz in the root directory, normally it is pretty big.

Restore:

The process of restore the new system through backup file is pretty simple, go to your backup file directory, assume we already copied it out into USB disk, mount it and copy it into root directory. Then we have:

1
cd /
tar xvpfz backup.tgz -C /
Last Updated ( Monday, 12 July 2010 16:34 )
 

How to manually create Ubuntu startup program

E-mail Print PDF

Same as other linux system, Ubuntu put all startup progams in /etc/init.d/ folder. We probably can find something like apache2 in /etc/init.d/, so that apache2 server could starup automatically when system reboots. It is automactially generally as soon as we finish installing the apache2. Here I give a rough idea how to create our own startup file, based on the experience of setup a private MMORPG server.

 We assume the program execuable startup file is locate on: /home/admin/rune/runServer/, the file name is Run.sh, then we suppose to have three operations to handle this startup command: start | stop | restart, here it is example to implements these three funcations:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/bash
##
##gameserver Starts L2DC Server
##
#chkconfig: - 66 34
# description: L2DC Server
# processname: gameserver
set -e
DESC="GameServer"
L2DIR="/home/*****/runeServer" # Directory with L2DC
L2USER="root" # User under which L2DC is running
GADDR="127.0.0.1" # IP address of Game server
GPORT="43594" # Port of game server
GCPORT="23" # Telnet port of game server
GPASS="*******" # Password for telnet to game server
DOWNTIME=""
test $# -gt 1 && DOWNTIME=$(echo $2 | sed -e 's/[^0-9]*//g')
test "$DOWNTIME" || DOWNTIME=10 # Default shutdown/restart time
#############################
g_start() {
echo -n " gameserver: "
if nc -z $GADDR $GPORT ; then
echo "already running"
else
cd "$L2DIR" || exit 1
./run.sh &
echo "started"
fi
}
g_stop() {
ACTION=$1
echo -n " gameserver: "
if ! nc -z $GADDR $GPORT ; then
echo "not running"
else
expect -c "
spawn telnet $GADDR $GCPORT
send \"quit\r\"
" > /dev/null
for ((i=$DOWNTIME ; i>0 ; i--)) ; do
echo -ne "\r gameserver: $i \r"
sleep 1
done
echo -n " gameserver: "
test "$ACTION" = "restart" && echo "restarted" || echo "stopped"
fi
}
g_shutabort() {
echo -n " gameserver: "
if ! nc -z $GADDR $GPORT ; then
echo "not running"
else
expect -c "
spawn telnet $GADDR $GCPORT
send \"abort\r\"
sleep 1
send \"quit\r\"
" > /dev/null
echo "shutdown or restart aborted"
fi
}
g_status() {
echo -n " gameserver: "
nc -z $GADDR $GPORT && echo "running" || echo "not running"
}
######################
cd "$L2DIR" || exit 1
case "$1" in
start)
echo "Starting $DESC: "
g_start
;;
stop)
echo "Stopping $DESC:"
g_stop shutdown
;;
restart|force-reload)
echo "Restarting $DESC: "
g_stop restart
;;
status)
echo "Status of $DESC:"
g_status
;;
abort)
echo "Aborting shutdown or restart of $DESC:"
g_shutabort
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status|abort}" >&2
exit 1
;;
esac
exit 0

 


Last Updated ( Wednesday, 07 July 2010 13:20 )
 

Open debugging port in weblogic server

E-mail Print PDF

The default debugger port of netbean is “8787″, it is not opened in weblogic server by default.

The easiest way to open this port is making a minor change for weblogic startup command, which normally is  “domains/yourdomain/bin/startWebLogic.cmd”. Add following two lines below ”
call “%DOMAIN_HOME%\bin\setDomainEnv.cmd” %*”

set SAVE_JAVA_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n %JAVA_OPTIONS%

set JAVA_OPTIONS=%SAVE_JAVA_OPTIONS%

Evenually weblogic startup command will append this java options at the end of itself.

Last Updated ( Wednesday, 07 July 2010 03:38 )
 
You are here: Home Content + 1 Column