sudo

visudo -f /etc/sudoers
##add
user1 ALL=(ALL) NOPASSWD: ALL
#%sudo ALL=(ALL:ALL) NOPASSWD: NOPASSWD: ALL
evan ALL=(ALL) NOPASSWD: ALL

centos sudo设定,不用每次输入密码

nginxlog切割脚本

#!/bin/bash
#vi cutlog.sh 不错的切割脚本 其实s135.com的写得更加简单呢
##查找nginx进程
nginx_bin=`ps aux | grep nginx | grep root | grep -v 'grep nginx' | awk '{print $14}'`
if [ $nginx_bin == /usr/local/nginx/sbin/nginx ];then
##如果nginx进程在,就找到配置文件,读取accesslog路径
#ACCLOG=`cat /usr/local/nginx/conf/nginx.conf | grep ' access_log' | awk '{print $2}'`
ACCLOG=`cat /usr/local/nginx/conf/hosts/1.conf | grep 'access_log' | awk '{print $2}' | cut -d";" -f1`
##同上错误日志的路径 这两个是假设nginx配置文件只有一个的情况下的
ERRLOG=`cat /usr/local/nginx/conf/nginx.conf| grep ^error | awk '{print $2}'| cut -d";" -f1`
## #查看是否有此文件
file $ACCLOG && file $ERRLOG
if [ $? -eq 0 ];then
###重命名当前日志
mv $ACCLOG $ACCLOG.`date -d "-1 day" +%F`
mv $ERRLOG $ERRLOG.`date -d "-1 day" +%F`
##创建空日志
touch $ACCLOG ;touch $ERRLOG
##修改属主
chown www:www $ACCLOG;chown www:www $ERRLOG
# #判断进程,并重新加载(这里的kill -USR1会使nginx将新产生的日志写到刚创建的新日志里面。) 其它我喜欢用 /etc/init.d/nginx reload
#[ -f /usr/local/nginx/logs/nginx.pid ] && kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
/etc/init.d/nginx reload
#压缩日志
gzip $ACCLOG.`date -d "-1 day" +%F`
gzip $ERRLOG.`date -d "-1 day" +%F`
# #将10天前的老日志清理到其他地方,(你们如果想删除的可以自己改成删除)
mv $ACCLOG.`date -d "-10 day" +%F`.gz /data/history.nginx.log/
mv $ERRLOG.`date -d "-10 day" +%F`.gz /data/history.nginx.log/
fi
fi

#!/bin/bash
# This script run at 00:00

# The Nginx logs path
logs_path="/usr/local/nginx/logs/"

mkdir -p ${logs_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/
mv ${logs_path}access.log ${logs_path}$(date -d "yesterday" +"%Y")/$(date -d "yesterday" +"%m")/access_$(date -d "yesterday" +"%Y%m%d").log
kill -USR1 `cat /usr/local/webserver/nginx/nginx.pid`

How To Mount The Google Nexus 5 on Ubuntu

Complete Guide to Mount Google Nexus 5 on Ubuntu:

sudo add-apt-repository ppa:langdalepl/gvfs-mtp
sudo apt-get update

1. Enable Developer options and enable USB debugging.

2. Install necessary MTP modules to your computer:
sudo apt-get install mtp-tools mtpfs

3. Configure 51-android.rules
sudo gedit /etc/udev/rules.d/51-android.rules

paste the following at the end of the file (if the file does not exist then just paste):
#– Nexus 5
evan@evan-laptop:~$ lsusb
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 006: ID 18d1:4ee2 Google Inc.

so
evan@evan-laptop:~/ cat /etc/udev/rules.d/51-android.rules
SUBSYSTEM==”usb”, ATTR{idVendor}==”18d1", MODE=”0666"

4. Make the file executable:
sudo chmod +x /etc/udev/rules.d/51-android.rules

5. Restart udev
sudo service udev restart

6. Create mount point and set permissions
sudo mkdir /media/nexus5
sudo chmod 755 /media/nexus5

7. Plug in the Nexus 5 and make sure MTP is enabled.

8. Paste following command whenever you PLUG-IN nexus5
sudo mtpfs -o allow_other /media/nexus5

9. When you have completed your work you must unmount:
sudo umount /media/nexus5

Note:
Repeat step8 every time you connect your nexus to your ubuntu OS and then step9 when you are done completing your work.

from http://www.omgubuntu.co.uk/2013/06/mount-nexus-4-on-ubuntu