Nginx: Restart
IF YOU HAVE init.d
sudo /etc/init.d/nginx restart
/etc/init.d/nginx: location of nginx startup script
IF YOU DO NOT HAVE init.d
service nginx restart
/opt/nginx variety:
sudo kill $(cat /opt/nginx/logs/nginx.pid)
sudo /opt/nginx/sbin/nginx
MySQL: Auto Increment
SELECT AUTO_INCREMENT
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = "databaseName"
AND TABLE_NAME = "tableName"
alter table tablename auto_increment = newvalue
Rails: Deploy Application using Capistrano
First, check that the deploy is ready to go:
cap ##ENVIRONMENT## deploy:check
Then, deploy away!
cap ##ENVIRONMENT## deploy
Git: Rename Remote Branch
You just have to create a new local branch with the desired name, push it to your remote, and then delete the old remote branch:
$ git branch new-branch-name origin/old-branch-name
$ git push origin new-branch-name
$ git push origin :old-branch-name
Apache: Access Log Bandwidth Reporting
MB of traffic a log file reports:
cat #ACCESS_LOG# | awk '{SUM+=$10}END{print SUM/1024/1024}'
MySQL: Database Size
SELECT table_schema "Data Base Name",
sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB",
sum( data_free )/ 1024 / 1024 "Free Space in MB"
FROM information_schema.TABLES
GROUP BY table_schema ;