1、老胡烤鸭舌
所有烧烤没一个烤糊的,烤鸭舌必点,非常嫩!咬一口还能爆汁!想吃饱是不可能的!必须提前预约!想插队订位是不可能的,不是老板级别的熟客老板不鸟。想提前吃是不可能的,七点开门七点才生炉子,七点半才有的吃。尽管这样,还是有很多人排队等着吃!
人均:178元
地址: 雨花台区 雨花西路(雨花台实验小学西校区)
2、仓巷酸菜鱼
和老胡烤鸭舌一起被誉为“目中无人牛逼哄哄”的奇葩店!这家店可以算是南京最贵的酸菜鱼馆了,单价300元一盆,够两三个人食用。这真是酸菜鱼中的爱马仕啊!环境像“世外桃源”,你在这边吃鱼,旁边的鸡在扑扑腾腾的拉屎!
人均:96元
地址: 秦淮区 仓巷41号(近升州路)
3、南京好婆私房菜
藏在科巷小区里一个黑漆漆乌麻麻的底楼住宅里,大门紧锁,吃饭必须按门铃!出去也要老板开锁!需要提前一天预定!皇帝炒饭120一份,一整条鳗鱼做的,不提前一天预约吃不到这份有贵族血统的炒饭!其余的菜也不便宜,但是量巨大,对的起这个价格!建议至少3个人去吃,点一道菜绝壁吃到撑。切记,进门吃饭要按门铃!!!
人均:50元
地址: 玄武区大行宫(新世纪广场)
4、天府食店
餐馆里的公务员啊!超拽!一天只开6个小时!来早要等,来晚老板娘轰人!店也小的可怜,只有4个4人小桌加一个包间。一共就十个菜,菜点少了不加,菜点多了不做。老板娘最牛的一句话是:我又没喊你来。不过如果你愿意排至少半个小时的队,且受得了中气十足的老板娘不断撵人的狂风暴雨,那这家传说中的牛店应该不会让你失望!酸菜鱼必点,和别家不同,她家是难得一见的清汤酸菜鱼,鱼片很嫩,鱼汤可以喝!豆花牛肉也不能错过!十个菜全点了也就两百多块。不过她家上菜是一桌全部上齐才做下一桌,所以坐下来等菜等上半个小时也是常事!赶时间的千万别去!
人均:32元
地址: 建宁路475号(阅江楼景区)
5、熊猫一间店
藏在珠江路偏僻小巷子里的一家奶茶店,老板拽的一比!开门与否看心情,不开门的话“可能”会在微博通知。卖什么也看心情,没有固定供应的卖品!坚决不放珍珠,坚决认为部分品种无法少糖,一人只能买一杯。但是开门必排队!普洱奶茶、小红莓都是很多吃货长草已久的单品。听说排队人群中藏龙卧虎,常有开凯迪拉克或保时捷的少女出没!
人均:10元
地址: 鼓楼区小粉桥3号(近南京大学)
6、徐家鸭子店(秦虹南路店)
不管你队排的有多长,人长得有多美,人家鸭子一卖完就关门!价格还比一般鸭店贵!不能更拽!谁让人家做的好吃呢。鸭子全是现烤,皮脆肉嫩,最绝的是他家的卤子,醇厚鲜甜,浓淡相宜,和鸭子搭配在一起,几近完美!这年头,买鸭要趁早!
人均:19元
地址: 秦淮区秦虹南路36号(近秦虹路)
7、 云中食品店(上海路店)
这家店拽就拽在服务员!个个都跟欠她们钱似的,看到老外,脸上立马堆出了笑容。而我们去买的时候,脸臭的要死。但是谁让他们家的蛋糕就是那么好吃呢,与服务员斗智斗勇吃到的蛋糕格外香。招牌提拉米苏,30一块,略带酒味,不甜腻,入口微苦,很顺滑!最好是堂食,因为外带奶油会融化,口感会打折。
人均:34元
地址: 鼓楼区上海路160号(近云南路)
8、金味栗子
排队排出名的栗子店,南京人没有不知道的!每年只开半年,半年里没一天不排长队,人排到马路中央是常事,排两个小时才买到一点也不夸张!每人限量50元,卖完关门!老板的态度也是一贯的傲娇,没办法,人多,任性!他家的栗子属于中等个头,不大不小的野生栗子,专门有人在旁边挑出不好的,所以炒出来的栗子个个都好,没有坏的。栗子壳薄易剥,软软糯糯, 不易受巨长无比人群惊吓的吃货一定要尝尝!
人均:31元
地址: 秦淮区明瓦廊大香炉23号(第五初级中学对面)
2016年10月9日星期日
2016年9月5日星期一
路由器DNS转发
转自:http://www.jiawei.me/2016/06/pandorabox.html
PandoraBox透明翻墙代理
昨天入手了一个Chromecast,用不了Shadowsocks等翻墙代理,没办法,只能拿出很久以前淘的改内存的Mercury MW305R来提供透明代理。我自己有个budgetvm VPS所以就自己搭一个shadowsocks服务器。
pip install shadowsocks
因为路由器性能有限,推荐使用chacha20加密
锐速官方不提供新安装了,github上有一个破解版锐速,用起来也是极好的。
https://github.com/91yun/serverspeeder
路由器刷了Pandorabox后先安装shadowsocks
opkg install shadowsocks
配置好把/etc/chinadns_chnroute.txt的内容复制到shadowsocks的ip白名单里就可以实现大陆ip绕过模式了。
pip install shadowsocks
因为路由器性能有限,推荐使用chacha20加密
锐速官方不提供新安装了,github上有一个破解版锐速,用起来也是极好的。
https://github.com/91yun/serverspeeder
路由器刷了Pandorabox后先安装shadowsocks
opkg install shadowsocks
配置好把/etc/chinadns_chnroute.txt的内容复制到shadowsocks的ip白名单里就可以实现大陆ip绕过模式了。
打开chromecast试试,什么?还是打不开?电脑也打不开youtube,应该是DNS污染,果然dig www.youtube.com发现是乱七八糟的ip。
路由器安装pdns来自建dns服务器吧
opkg install pdnsd
修改/etc/pdnsd.conf
global {
perm_cache=1024;
cache_dir="/var/pdnsd";
run_as="nobody";
server_port = 1053;
server_ip = 127.0.0.1;
status_ctl = on;
query_method=tcp_only; #注意!tcp_only
min_ttl=15m;
max_ttl=1w;
timeout=10;
}
server {
label= "budgetvm";
ip = ***.***.***.***;#这里填支持tcp获取dns的服务器,也可以是自建的
root_server = on;
uptest = none;
}
服务器端也安装一个pdnsd
global {
perm_cache=1024;
cache_dir="/var/pdnsd";
run_as="nobody";
server_port = 53;
server_ip = 127.0.0.1;
status_ctl = on;
query_method=tcp_only;
min_ttl=15m;
max_ttl=1w;
timeout=10;
}
server {
label= "budgetvm";
ip = 8.8.8.8;直接用google的吧
root_server = on;
uptest = none;
}
启动后把路由器的dns解析定向到pdnsd
电脑可以打开youtube了,Chromecast还是不行,netstat查了一下,发现chromecast直接查询8.8.8.8了,还是被污染,好吧,那我也dns劫持一下吧。。。
iptables -t nat -A PREROUTING -s 192.168.1.1/24 -p udp --dport 53 -j DNAT --to 192.168.1.1
iptables -t nat -A PREROUTING -s 192.168.1.1/24 -p tcp --dport 53 -j DNAT --to 192.168.1.1
这次成功搞定,不过所有dns全部由外边服务器解析,国内的网站速度跟不上。
到https://github.com/felixonmars/dnsmasq-china-list下载accelerated-domains.china.conf 和 bogus-nxdomain.china.conf 放到 /etc/dnsmasq.d。
echo conf-dir=/etc/dnsmasq.d >/etc/dnsmasq.conf
echo server=/#/127.0.0.1#1053 >/etc/dnsmasq.d/gfwlist.conf
这样就把国内外的dns解析分开了,因为dnsmasq优先匹配详值
记得把这里的dns服务器删除。
至此一个完美的透明代理路由器搞定。
2016年7月10日星期日
haproxy gmail
apt-get install haproxy
vim /etc/default/haproxy
Set the ENABLED option to 1
service haproxy
/etc/haproxy/haproxy.cfg
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
defaults
log global
mode tcp
option dontlognull
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen smtp
bind 0.0.0.0:2014
mode tcp
log global
server s1 smtp.gmail.com:465
listen pop
bind 0.0.0.0:2015
mode tcp
log global
server s2 pop.gmail.com:995
listen imap
bind 0.0.0.0:2016
mode tcp
log global
server s3 imap.gmail.com:993
vim /etc/default/haproxy
Set the ENABLED option to 1
service haproxy
/etc/haproxy/haproxy.cfg
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
defaults
log global
mode tcp
option dontlognull
contimeout 5000
clitimeout 50000
srvtimeout 50000
listen smtp
bind 0.0.0.0:2014
mode tcp
log global
server s1 smtp.gmail.com:465
listen pop
bind 0.0.0.0:2015
mode tcp
log global
server s2 pop.gmail.com:995
listen imap
bind 0.0.0.0:2016
mode tcp
log global
server s3 imap.gmail.com:993
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
maxconn 4000
user haproxy
group haproxy
daemon
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
log global
mode tcp
option dontlognull
timeout connect 1000
timeout client 150000
timeout server 150000
maxconn 60000
retries 3
listen smtp
bind *:465
mode tcp
log global
server s1 smtp.gmail.com:465
listen pop
bind *:995
mode tcp
log global
server s2 pop.gmail.com:995
listen imap
bind *:993
mode tcp
log global
server s3 imap.gmail.com:993
2016年6月2日星期四
华为AR路由器限制telnet登录
sys
acl 2222
rule permit source 10.50.0.0 0.0.1.255
quit
system-view
user-interface vty 0 4
acl 2222 inbound
quit
注意:acl 2222中一定要包含您远程管理的ip否则,远程管理就无法登陆了
acl 2222
rule permit source 10.50.0.0 0.0.1.255
quit
system-view
user-interface vty 0 4
acl 2222 inbound
quit
注意:acl 2222中一定要包含您远程管理的ip否则,远程管理就无法登陆了
2016年5月10日星期二
ubuntu 14.04 下安装 odoo9
https://www.rosehosting.com/blog/install-odoo-9-on-ubuntu-14-04/
odoo-install.sh
Edit the Odoo configuration file and set the master admin password:
Change the template encoding to UTF8 by running the following commands:
install etherpad
https://github.com/ether/etherpad-lite#installation
安装nodejs
wget https://nodejs.org/dist/v4.5.0/node-v4.5.0.tar.gz
tar -xvzf node-v4.5.0.tar.gz
./configure
make
make install
odoo-install.sh
#!/bin/bash
################################################################################
# Script for Installation: ODOO Saas4/Trunk server on Ubuntu 14.04 LTS
# Author: Yenthe Van Ginneken
#-------------------------------------------------------------------------------
#
# This script will install Odoo on your Ubuntu 14.04 server. It can install multiple Odoo instances
# in one Ubuntu because of the different xmlrpc_ports
#-------------------------------------------------------------------------------
# USAGE:
#
# odoo-install
#
# EXAMPLE:
# ./odoo-install
#
################################################################################
##fixed parameters
#odoo
OE_USER="odoo"
OE_HOME="/$OE_USER"
OE_HOME_EXT="/$OE_USER/$OE_USER-server"
#The default port where this Odoo instance will run under (provided you use the command -c in the terminal)
#Set to true if you want to install it, false if you don't need it or have it already installed.
INSTALL_WKHTMLTOPDF="True"
#Set the default Odoo port (you still have to use -c /etc/odoo-server.conf for example to use this.)
OE_PORT="8069"
#Choose the Odoo version which you want to install. For example: 9.0, 8.0, 7.0 or saas-6. When using 'trunk' the master version will be installed.
#IMPORTANT! This script contains extra libraries that are specifically needed for Odoo 9.0
OE_VERSION="9.0"
#set the superadmin password
OE_SUPERADMIN="admin"
OE_CONFIG="$OE_USER-server"
#--------------------------------------------------
# Update Server
#--------------------------------------------------
echo -e "\n---- Update Server ----"
sudo apt-get update
sudo apt-get upgrade -y
#--------------------------------------------------
# Install PostgreSQL Server
#--------------------------------------------------
echo -e "\n---- Install PostgreSQL Server ----"
sudo apt-get install postgresql -y
echo -e "\n---- PostgreSQL $PG_VERSION Settings ----"
sudo sed -i s/"#listen_addresses = 'localhost'"/"listen_addresses = '*'"/g /etc/postgresql/9.3/main/postgresql.conf
echo -e "\n---- Creating the ODOO PostgreSQL User ----"
sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true
#--------------------------------------------------
# Install Dependencies
#--------------------------------------------------
echo -e "\n---- Install tool packages ----"
sudo apt-get install wget subversion git bzr bzrtools python-pip -y
echo -e "\n---- Install python packages ----"
sudo apt-get install python-dateutil python-feedparser python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-docutils python-psutil python-mock python-unittest2 python-jinja2 python-pypdf python-decorator python-requests python-passlib python-pil -y
echo -e "\n---- Install python libraries ----"
sudo pip install gdata
echo -e "\n--- Install other required packages"
sudo apt-get install node-clean-css
sudo apt-get install node-less
sudo apt-get install python-gevent
#--------------------------------------------------
# Install Wkhtmltopdf if needed
#--------------------------------------------------
if [ $INSTALL_WKHTMLTOPDF = "True" ]; then
echo -e "\n---- Install wkhtml and place on correct place for ODOO 8 ----"
sudo wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin
else
echo "Wkhtmltopdf isn't installed due to the choice of the user!"
fi
echo -e "\n---- Create ODOO system user ----"
sudo adduser --system --quiet --shell=/bin/bash --home=$OE_HOME --gecos 'ODOO' --group $OE_USER
#The user should also be added to the sudo'ers group.
sudo adduser $OE_USER sudo
echo -e "\n---- Create Log directory ----"
sudo mkdir /var/log/$OE_USER
sudo chown $OE_USER:$OE_USER /var/log/$OE_USER
#--------------------------------------------------
# Install ODOO
#--------------------------------------------------
echo -e "\n==== Installing ODOO Server ===="
sudo git clone --branch $OE_VERSION https://www.github.com/odoo/odoo $OE_HOME_EXT/
echo -e "\n---- Create custom module directory ----"
sudo su $OE_USER -c "mkdir $OE_HOME/custom"
sudo su $OE_USER -c "mkdir $OE_HOME/custom/addons"
echo -e "\n---- Setting permissions on home folder ----"
sudo chown -R $OE_USER:$OE_USER $OE_HOME/*
echo -e "* Create server config file"
sudo cp $OE_HOME_EXT/debian/openerp-server.conf /etc/$OE_CONFIG.conf
sudo chown $OE_USER:$OE_USER /etc/$OE_CONFIG.conf
sudo chmod 640 /etc/$OE_CONFIG.conf
echo -e "* Change server config file"
sudo sed -i s/"db_user = .*"/"db_user = $OE_USER"/g /etc/$OE_CONFIG.conf
sudo sed -i s/"; admin_passwd.*"/"admin_passwd = $OE_SUPERADMIN"/g /etc/$OE_CONFIG.conf
sudo su root -c "echo 'logfile = /var/log/$OE_USER/$OE_CONFIG$1.log' >> /etc/$OE_CONFIG.conf"
sudo su root -c "echo 'addons_path=$OE_HOME_EXT/addons,$OE_HOME/custom/addons' >> /etc/$OE_CONFIG.conf"
echo -e "* Create startup file"
sudo su root -c "echo '#!/bin/sh' >> $OE_HOME_EXT/start.sh"
sudo su root -c "echo 'sudo -u $OE_USER $OE_HOME_EXT/openerp-server --config=/etc/$OE_CONFIG.conf' >> $OE_HOME_EXT/start.sh"
sudo chmod 755 $OE_HOME_EXT/start.sh
#--------------------------------------------------
# Adding ODOO as a deamon (initscript)
#--------------------------------------------------
echo -e "* Create init file"
echo '#!/bin/sh' >> ~/$OE_CONFIG
echo '### BEGIN INIT INFO' >> ~/$OE_CONFIG
echo '# Provides: $OE_CONFIG' >> ~/$OE_CONFIG
echo '# Required-Start: $remote_fs $syslog' >> ~/$OE_CONFIG
echo '# Required-Stop: $remote_fs $syslog' >> ~/$OE_CONFIG
echo '# Should-Start: $network' >> ~/$OE_CONFIG
echo '# Should-Stop: $network' >> ~/$OE_CONFIG
echo '# Default-Start: 2 3 4 5' >> ~/$OE_CONFIG
echo '# Default-Stop: 0 1 6' >> ~/$OE_CONFIG
echo '# Short-Description: Enterprise Business Applications' >> ~/$OE_CONFIG
echo '# Description: ODOO Business Applications' >> ~/$OE_CONFIG
echo '### END INIT INFO' >> ~/$OE_CONFIG
echo 'PATH=/bin:/sbin:/usr/bin' >> ~/$OE_CONFIG
echo "DAEMON=$OE_HOME_EXT/openerp-server" >> ~/$OE_CONFIG
echo "NAME=$OE_CONFIG" >> ~/$OE_CONFIG
echo "DESC=$OE_CONFIG" >> ~/$OE_CONFIG
echo '' >> ~/$OE_CONFIG
echo '# Specify the user name (Default: odoo).' >> ~/$OE_CONFIG
echo "USER=$OE_USER" >> ~/$OE_CONFIG
echo '' >> ~/$OE_CONFIG
echo '# Specify an alternate config file (Default: /etc/openerp-server.conf).' >> ~/$OE_CONFIG
echo "CONFIGFILE=\"/etc/$OE_CONFIG.conf\"" >> ~/$OE_CONFIG
echo '' >> ~/$OE_CONFIG
echo '# pidfile' >> ~/$OE_CONFIG
echo 'PIDFILE=/var/run/$NAME.pid' >> ~/$OE_CONFIG
echo '' >> ~/$OE_CONFIG
echo '# Additional options that are passed to the Daemon.' >> ~/$OE_CONFIG
echo 'DAEMON_OPTS="-c $CONFIGFILE"' >> ~/$OE_CONFIG
echo '[ -x $DAEMON ] || exit 0' >> ~/$OE_CONFIG
echo '[ -f $CONFIGFILE ] || exit 0' >> ~/$OE_CONFIG
echo 'checkpid() {' >> ~/$OE_CONFIG
echo '[ -f $PIDFILE ] || return 1' >> ~/$OE_CONFIG
echo 'pid=`cat $PIDFILE`' >> ~/$OE_CONFIG
echo '[ -d /proc/$pid ] && return 0' >> ~/$OE_CONFIG
echo 'return 1' >> ~/$OE_CONFIG
echo '}' >> ~/$OE_CONFIG
echo '' >> ~/$OE_CONFIG
echo 'case "${1}" in' >> ~/$OE_CONFIG
echo 'start)' >> ~/$OE_CONFIG
echo 'echo -n "Starting ${DESC}: "' >> ~/$OE_CONFIG
echo 'start-stop-daemon --start --quiet --pidfile ${PIDFILE} \' >> ~/$OE_CONFIG
echo '--chuid ${USER} --background --make-pidfile \' >> ~/$OE_CONFIG
echo '--exec ${DAEMON} -- ${DAEMON_OPTS}' >> ~/$OE_CONFIG
echo 'echo "${NAME}."' >> ~/$OE_CONFIG
echo ';;' >> ~/$OE_CONFIG
echo 'stop)' >> ~/$OE_CONFIG
echo 'echo -n "Stopping ${DESC}: "' >> ~/$OE_CONFIG
echo 'start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \' >> ~/$OE_CONFIG
echo '--oknodo' >> ~/$OE_CONFIG
echo 'echo "${NAME}."' >> ~/$OE_CONFIG
echo ';;' >> ~/$OE_CONFIG
echo '' >> ~/$OE_CONFIG
echo 'restart|force-reload)' >> ~/$OE_CONFIG
echo 'echo -n "Restarting ${DESC}: "' >> ~/$OE_CONFIG
echo 'start-stop-daemon --stop --quiet --pidfile ${PIDFILE} \' >> ~/$OE_CONFIG
echo '--oknodo' >> ~/$OE_CONFIG
echo 'sleep 1' >> ~/$OE_CONFIG
echo 'start-stop-daemon --start --quiet --pidfile ${PIDFILE} \' >> ~/$OE_CONFIG
echo '--chuid ${USER} --background --make-pidfile \' >> ~/$OE_CONFIG
echo '--exec ${DAEMON} -- ${DAEMON_OPTS}' >> ~/$OE_CONFIG
echo 'echo "${NAME}."' >> ~/$OE_CONFIG
echo ';;' >> ~/$OE_CONFIG
echo '*)' >> ~/$OE_CONFIG
echo 'N=/etc/init.d/${NAME}' >> ~/$OE_CONFIG
echo 'echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2' >> ~/$OE_CONFIG
echo 'exit 1' >> ~/$OE_CONFIG
echo ';;' >> ~/$OE_CONFIG
echo '' >> ~/$OE_CONFIG
echo 'esac' >> ~/$OE_CONFIG
echo 'exit 0' >> ~/$OE_CONFIG
echo -e "* Security Init File"
sudo mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG
sudo chmod 755 /etc/init.d/$OE_CONFIG
sudo chown root: /etc/init.d/$OE_CONFIG
echo -e "* Change default xmlrpc port"
sudo su root -c "echo 'xmlrpc_port = $OE_PORT' >> /etc/$OE_CONFIG.conf"
echo -e "* Start ODOO on Startup"
sudo update-rc.d $OE_CONFIG defaults
echo -e "* Starting Odoo Service"
sudo su root -c "/etc/init.d/$OE_CONFIG start"
echo "-----------------------------------------------------------"
echo "Done! The Odoo server is up and running. Specifications:"
echo "Port: $OE_PORT"
echo "User service: $OE_USER"
echo "User PostgreSQL: $OE_USER"
echo "Code location: $OE_USER"
echo "Addons folder: $OE_USER/$OE_CONFIG/addons/"
echo "Start Odoo service: sudo service $OE_CONFIG start"
echo "Stop Odoo service: sudo service $OE_CONFIG stop"
echo "Restart Odoo service: sudo service $OE_CONFIG restart"
echo "-----------------------------------------------------------"
Edit the Odoo configuration file and set the master admin password:
Change the template encoding to UTF8 by running the following commands:
$ su - postgres $ psql $ update pg_database set datallowconn = TRUE where datname = 'template0'; $ \c template0 $ update pg_database set datistemplate = FALSE where datname = 'template1'; $ drop database template1; $ create database template1 with template = template0 encoding = 'UTF8'; $ update pg_database set datistemplate = TRUE where datname = 'template1'; $ \c template1 $ update pg_database set datallowconn = FALSE where datname = 'template0'; $ \q
Restart the PostgreSQL server for the changes to take effect:
$ /etc/init.d/postgresql restart
Then, restart the Odoo service:
$ /etc/init.d/odoo-server restart
install etherpad
https://github.com/ether/etherpad-lite#installation
安装nodejs
wget https://nodejs.org/dist/v4.5.0/node-v4.5.0.tar.gz
tar -xvzf node-v4.5.0.tar.gz
./configure
make
make install
- Create a user called etherpad-lite:
adduser etherpad-lite --system --group --home /var/etherpad - Setup a log folder for the service
- Create:
mkdir /var/log/etherpad-lite - Permiss:
chown -R etherpad-lite /var/log/etherpad-lite
- Create:
- Ensure app has full access to its source folder:
chown -R etherpad-lite /path/to/install/dir - Copy following script to /etc/init.d/ and configure the variables. You might want also configure the runSafe script in your git folder to ensure you get email notifications if there are problems with the applications
- Make sure the script is marked as executable:
chmod +x /etc/init.d/etherpad-lite - If etherpad-lite is not installed in /usr/share/etherpad-lite create a link with
ln -s /your-path-to/etherpad-lite /usr/share/etherpad-lite - Enable it with
update-rc.d etherpad-lite defaults - start with
service etherpad-lite start
#!/bin/sh
### BEGIN INIT INFO
# Provides: etherpad-lite
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts etherpad lite
# Description: starts etherpad lite using start-stop-daemon
### END INIT INFO
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/node/bin"
LOGFILE="/var/log/etherpad-lite/etherpad-lite.log"
EPLITE_DIR="/usr/share/etherpad-lite"
EPLITE_BIN="bin/safeRun.sh"
USER="etherpad-lite"
GROUP="etherpad-lite"
DESC="Etherpad Lite"
NAME="etherpad-lite"
set -e
. /lib/lsb/init-functions
start() {
echo "Starting $DESC... "
start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --exec $EPLITE_DIR/$EPLITE_BIN -- $LOGFILE || true
echo "done"
}
#We need this function to ensure the whole process tree will be killed
killtree() {
local _pid=$1
local _sig=${2-TERM}
for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
killtree ${_child} ${_sig}
done
kill -${_sig} ${_pid}
}
stop() {
echo "Stopping $DESC... "
if test -f /var/run/$NAME.pid; then
while test -d /proc/$(cat /var/run/$NAME.pid); do
killtree $(cat /var/run/$NAME.pid) 15
sleep 0.5
done
rm /var/run/$NAME.pid
fi
echo "done"
}
status() {
status_of_proc -p /var/run/$NAME.pid "" "etherpad-lite" && exit 0 || exit $?
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $NAME {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0
订阅:
评论 (Atom)