Skip to content

Instantly share code, notes, and snippets.

View mariusv's full-sized avatar

Marius Voila mariusv

View GitHub Profile
@mariusv
mariusv / stats
Created May 9, 2012 09:39
Linux script to collect system statistics and send to your email
#!/bin/bash
SERVER="mydomain.com"
EMAIL_TO="your_email@gmail.com"
EMAIL_FROM="stat@mydomain.com"
# logged in users and what are they running
WHO=`w`
@mariusv
mariusv / syncany.sh
Created June 3, 2011 22:10
backup script and upload via sftp
#!/bin/sh
# Settings
#############################
REMOTEHOST="example.com"
REMOTEBACKUPDIR="backup/sql"
SQLHOST="localhost"
SQLDB="database_name"
SQLUSER="username"
SQLPASS="password"
SQLFILE="database_name.sql"
@mariusv
mariusv / root
Created January 15, 2011 11:04
#!/bin/sh DEV1=ppp0 IP1=100.0.1.1 GW1=100.0.1.254 TABLE2=connection2 DEV2=ppp1 IP2=100.0.2.1 GW2=100.0.2.254 ip route flush table $TABLE1 ip route flush table $TABLE2 ip route show table main | grep -Ev '(^default|ppp)' | while read ROUTE ; do
#!/bin/sh
DEV1=ppp0
IP1=100.0.1.1
GW1=100.0.1.254
TABLE2=connection2
DEV2=ppp1
IP2=100.0.2.1
GW2=100.0.2.254
ip route flush table $TABLE1
ip route flush table $TABLE2
#!/bin/sh
#
# after.sh
# Author: Marius Voila
# Created: 06/25/2010
# Updated: 07/19/2010
#
# This script is more specific to my needs. I run it after server.sh.
# To get the pg gem to install, I generally have to restart my shell so
# the path to pg_config works.
server {
listen 80;
server_name example.com;
root /var/www/example.com/public;
#rails_env development;
passenger_enabled on;
charset utf-8;
}
server {
listen 80;
server_name example.com;
root /var/www/example.com/public;
#rails_env development;
passenger_enabled on;
charset utf-8;
}
user nginx nginx;
worker_processes 5;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
#!/bin/bash
#chkconfig: 2345 80 05
#description: Nginx
. /etc/rc.d/init.d/functions
INITLOG_ARGS=""
nginx=/usr/local/nginx/sbin/nginx
prog=nginx
#!/bin/sh
#
# server.sh
# Author: Marius Voila
# Created: 06/25/2010
# Updated: 07/19/2010
#
# See my blog post on this script: http://mariusv.com/rackspace-cloud-new-server-script
#
# This script installs everything needed to run a Ruby on Rails application on
###
# VSFTPD.CONF for virtual users with write/read/delete permissions
###
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
xferlog_enable=YES
connect_from_port_20=YES
chown_uploads=YES