To encrypt use:
openssl enc -e -bf-cbc -in <FILE.zip> -out <FILE.ENC>This will ask you for a password that you'll need to decrypt the file.
And to decrypt:
openssl enc -d -bf-cbc -in <FILE.ENC> -out <FILE.zip>
openssl enc -e -bf-cbc -in <FILE.zip> -out <FILE.ENC>This will ask you for a password that you'll need to decrypt the file.
openssl enc -d -bf-cbc -in <FILE.ENC> -out <FILE.zip>
#!/bin/sh
#-----------------------------------------------------------------------
# FILE ROTATOR SCRIPT
#
# The purpose of this script is to rotate, compress and delete files
# - Files older than ARC_AGE are gzipped and rotated
# - Files bigger than SIZE_LIM are gzipped and rotated
# - Gzipped files older than DEL_AGE are deleted
#
#-----------------------------------------------------------------------
# Vars
DATE=`date +%F"-"%H:%M`
FILEDIR="/storage/logs/"
DEL_AGE="30"
ARC_AGE="1"
SIZE_LIM="20M"
# Diagnostics
echo "-= Rotation starting =-"
echo " Directory to search: $FILEDIR"
echo " File age to check for delition: $DEL_AGE"
echo " File age to check for archive: $ARC_AGE"
echo " File size to check for archive: $SIZE_LIM"
echo " "
# Compress all unconpressed files which last modification occured more than ARC_AGE days ago
echo "-= Looking for old files =-"
FILES=`find $FILEDIR -type f -mtime +$ARC_AGE -not \( -name '*.gz' \) -print`
echo "Files to be archived:"
echo $FILES
echo " "
for FILE in $FILES; do
# Compress but keep the original file
gzip -9 -c "$FILE" > "$FILE".$DATE.gz;
# Check if file is beeing used:
lsof $FILE
ACTIVE=$?
# Delete inactive files, truncate if active
if [ $ACTIVE != 0 ]; then
# Delete the file
rm "$FILE";
else
# Truncate file to 0
:>"$FILE";
fi
done
# Compress all unconpressed files that are bigger than SIZE_LIM
echo "-= Looking for big files =-"
FILES=`find $FILEDIR -type f -size +$SIZE_LIM -not \( -name '*.gz' \) -print`
echo "Files to be archived:"
echo $FILES
echo " "
for FILE in $FILES; do
# Compress but keep the original file
gzip -9 -c "$FILE" > "$FILE".$DATE.gz;
# Truncate original file to 0
:>"$FILE";
done
echo "-= Deleting old archived files =-"
FILES_OLD=`find $FILEDIR -type f -mtime +$DEL_AGE -name '*.gz' -print`
echo "Archived files older than $DEL_AGE days to be deleted:"
echo $FILES_OLD
echo " "
# Deletes old archived files.
find $FILEDIR -type f -mtime +$DEL_AGE -name '*.gz' -exec rm -f {} \;
echo "-= Rotation completed =-"
echo " "
for i in *; do mv $i `echo $i | tr [:upper:] [:lower:]`; done
hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.isoNote: OS X tends to put the .dmg ending on the output file automatically.
diskutil listto get the current list of devices
diskutil listagain and determine the device node assigned to your flash media (e.g. /dev/disk2)
diskutil unmountDisk /dev/diskN(replace N with the disk number from the last command; in the previous example, N would be 2)
sudo dd if=/path/to/downloaded.img of=/dev/diskN bs=1m(replace /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.img or ./ubuntu.dmg).
diskutil eject /dev/diskNand remove your flash media when the command completes
wget http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2And install it:
tar xf broadcom-wl-5.100.138.tar.bz2then add:
sudo apt-get install b43-fwcutter
sudo b43-fwcutter -w "/lib/firmware" broadcom-wl-5.100.138/linux/wl_apsta.o
b43to /etc/modules and reboot
vi ~/.Xmodmapand paste the following inside:
!!Enable Natural scrolling (vertical and horizontal)Under Mac OS X, the combination cmd+space opens Spotlight, to emulate this, install the package compizconfig-settings-manager.
pointer = 1 2 3 5 4 7 6 8 9 10 11 12
!!Swap CMD and CTRL keys
remove control = Control_L
remove mod4 = Super_L Super_R
keysym Control_L = Super_L
keysym Super_L = Control_L
keysym Super_R = Control_L
add control = Control_L Control_R
add mod4 = Super_L Super_R
sudo aptitude install compizconfig-settings-managerOpen it using the ccsm command, or search for it in Dash.
http://www.oracle.com/technetwork/products/express-edition/downloads/index.html( You will need to create a free oracle web account if you don't already have it )
unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zipInstall the following packages :
sudo apt-get install alien libaio1 unixodbc vimThe Red Hat based installer of Oracle XE 11gR2 relies on /sbin/chkconfig, which is not used in Ubuntu. The chkconfig package available for the current version of Ubuntu produces errors and my not be safe to use. So you'll need to create a special chkconfig script, below is a simple trick to get around the problem and install Oracle XE successfully:
sudo vi /sbin/chkconfig(copy and paste the following into the file )
#!/bin/bashSave the above file and provide appropriate execute privilege :
# Oracle 11gR2 XE installer chkconfig hack for Ubuntu
file=/etc/init.d/oracle-xe
if [[ ! `tail -n1 $file | grep INIT` ]]; then
echo >> $file
echo '### BEGIN INIT INFO' >> $file
echo '# Provides: OracleXE' >> $file
echo '# Required-Start: $remote_fs $syslog' >> $file
echo '# Required-Stop: $remote_fs $syslog' >> $file
echo '# Default-Start: 2 3 4 5' >> $file
echo '# Default-Stop: 0 1 6' >> $file
echo '# Short-Description: Oracle 11g Express Edition' >> $file
echo '### END INIT INFO' >> $file
fi
update-rc.d oracle-xe defaults 80 01
#EOF
chmod 755 /sbin/chkconfigOracle 11gR2 XE requires to set the following additional kernel parameters:
sudo vi /etc/sysctl.d/60-oracle.conf(Enter the following)
# Oracle 11g XE kernel parameters(Save the file)
fs.file-max=6815744
net.ipv4.ip_local_port_range=9000 65000
kernel.sem=250 32000 100 128
kernel.shmmax=536870912
sudo cat /etc/sysctl.d/60-oracle.confLoad new kernel parameters:
sudo service procps startVerify:
sudo sysctl -q fs.file-maxIncrease the system swap space : Analyze your current swap space by following command :
-> fs.file-max = 6815744
free -mMinimum swap space requirement of Oracle 11gR2 XE is 2 GB . In case, your is lesser , you can increase it by following steps in one of my previous posts.
sudo ln -s /usr/bin/awk /bin/awkConvert the red-hat ( rpm ) package to Ubuntu-package :
sudo mkdir -p /var/lock/subsys
sudo touch /var/lock/subsys/listener
sudo alien --scripts -d oracle-xe-11.2.0-1.0.x86_64.rpm(this may take a long time)
sudo dpkg --install oracle-xe_11.2.0-2_amd64.deb
sudo rm -rf /dev/shm(here size will be the size of your RAM in MBs ).
sudo mkdir /dev/shm
sudo mount -t tmpfs shmfs -o size=2048m /dev/shm
sudo vi /etc/rc2.d/S01shm_loadThen copy and paste following lines into the file :
#!/bin/shSave the file and provide execute permissions :
case "$1" in
start) mkdir /var/lock/subsys 2>/dev/null
touch /var/lock/subsys/listener
rm /dev/shm 2>/dev/null
mkdir /dev/shm 2>/dev/null
mount -t tmpfs shmfs -o size=2048m /dev/shm ;;
*) echo error
exit 1 ;;
esac
chmod 755 /etc/rc2.d/S01shm_loadThis will ensure that every-time you start your system, you get a working Oracle environment.
sudo /etc/init.d/oracle-xe configureEnter the following configuration information:
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xeb) execute your .profile to load the changes:
export ORACLE_SID=XE
export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
export ORACLE_BASE=/u01/app/oracle
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
source /etc/bash.bashrcStart the Oracle 11gR2 XE :
sudo service oracle-xe startThe output should be similar to following :
user@machine:~$ sudo service oracle-xe startAnd you're done :)
Starting Oracle Net Listener.
Starting Oracle Database 11g Express Edition instance.
user@machine:~$
tail -f /var/log/logfile | perl -p -e 's/(something)/\033[7;1m$1\033[0m/g;'or if your terminal supports colours, e.g. linux terminal, you can use this:
tail -f /var/log/logfile | perl -p -e 's/(something)/\033[46;1m$1\033[0m/g;'If you need to highlight multiple words you can use something like this:
tail -f /var/log/logfile | perl -p -e 's/\b(something|something_else)\b/\033[46;1m$1\033[0m/g;'and if you want it to beep on a match use this:
tail -f /var/log/logfile | perl -p -e 's/(something)/\033[46;1m$1\033[0m\007/g;'If you find that perl is too heavy for this you can use sed:
tail -f /var/log/logfile | sed "s/\(something\)/\x1b[46;1m\1\x1b[0m/g"Note, that in the last example you have to actually type “cntl-v cntl-[” in place of “^[”
man console_codes
select
concat(table_name, '.', column_name) as 'foreign key',
concat(referenced_table_name, '.', referenced_column_name) as 'references'
from
information_schema.key_column_usage
where
referenced_table_name is not null;
sudo apt-get install sqlfairyNext, dump your database tables, e.g. for MySQL:
mysqldump -u username -p -d mydatabase > mydatabase.sqlFinally, for a PNG image of your schema:
sqlt-graph -f MySQL -o mydatabase.png -t png mydatabase.sqlIf your schema lacks explicit foreign keys, try the –natural-join options (man sqlt-graph, man sqlt-diagram)
echo ".schema" | sqlite3 ~/.liferea_1.4/liferea.db >> liferea.sqlGenerate a SVG diagram with:
sqlt-graph -c --natural-join --from=SQLite -t svg -o liferea_schema.svg liferea.sql
SELECT id, name, email INTO OUTFILE '/tmp/result.csv'Or you can use sed:
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
ESCAPED BY ‘\\’
LINES TERMINATED BY '\n'
FROM users WHERE 1
mysql -u username -ppassword database -B -e "SELECT * FROM table;" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > filename.csvExplanation:
#!/bin/bashJust be sure to change the configuration section to meet your needs.
#### Begin Configuration ####
DB="mydb"
MYSQL_USER="root"
MYSQL_PASSWD='mypass'
MYSQL_HOST="127.0.0.1"
MYSQL_PORT="3306"
MYSQL="/usr/bin/mysql"
#### End Configuration ####
MYSQL_CMD="$MYSQL -u $MYSQL_USER -p$MYSQL_PASSWD -P $MYSQL_PORT -h $MYSQL_HOST"
TABLES=`$MYSQL_CMD --batch -N -D $DB -e "show tables"`
for TABLE in $TABLES
do
SQL="SELECT * FROM $TABLE;"
OUTFILE=$TABLE.csv
$MYSQL_CMD --database=$DB --execute="$SQL" | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > $OUTFILE
done
chmod +x ./export_csv.shIf you want to have all of the exported files in a certain directory, you could either modify the script or just make the cirectory, "cd" into it, and then run the script. It assumes you want to create the files in the current working directory.
OUTFILE="/my_path/$TABLE.csv"
echo ".schema" | sqlite3 ~/.liferea_1.4/liferea.db >> liferea.sql
$ dateOr checking the timezone file with:
Mon Sep 3 18:03:04 WEST 2012
$ cat /etc/timezoneSo to change it just run
Europe/Lisbon
$ sudo dpkg-reconfigure tzdataAlso be sure to restart cron as it won’t pick up the timezone change and will still be running on UTC.
And follow on screen instructions. Easy.
$ /etc/init.d/cron stopyou might also want to install ntp to keep the correct time:
$ /etc/init.d/cron start
aptitude install ntp
/opt/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/share-documentlibrary-config.xmlReplace:
<!-- Manage permissions (site roles) -->With:
<action id="document-manage-site-permissions" type="javascript" icon="document-manage-permissions" label="actions.document.manage-permissions">
<param name="function">onActionManagePermissions</param>
<permissions>
<permission allow="true">ChangePermissions</permission>
</permissions>
<evaluator>evaluator.doclib.action.siteBased</evaluator>
</action>
<!-- Manage permissions (site roles) -->
<action id="document-manage-site-permissions" type="pagelink" icon="document-manage-permissions" label="actions.document.manage-permissions">
<param name="page">manage-permissions?nodeRef={node.nodeRef}</param>
<permissions>
<permission allow="true">ChangePermissions</permission>
</permissions>
<evaluator>evaluator.doclib.action.siteBased</evaluator>
</action>
/opt/alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/share-config.xmlfind this line within the <header> tags
<item type="link" id="repository" condition="conditionRepositoryRootNode">/repository</item>Change it to:
<item type="link" id="repository" permission="admin" condition="conditionRepositoryRootNode">/repository</item>Reload Alfresco. Now only admin users will see that link.
ps aux | sort -nk +4 | tail -20Show the 20 most CPU/Memory hungry processes
ps aux | sort -nk +3 | tail -20Or, run both:
echo "CPU:" && ps aux | sort -nk +3 | tail -20 && echo "Memory:" && ps aux | sort -nk +4 | tail -20
<?xml version="1.0" encoding="UTF-8"?>The path attribute sets the context used in the URL. Using "" as the path thus means 'use as default'. The docBase attribute sets where the real webapp is. When using Alfresco Share this is share.war by default, it's not necessary to use the absolute path.
<Context path="" docBase="share.war">
</Context>
...Restart Tomcat again for the connector to be available.
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
...
worker.list=tomcatThe name tomcat is arbitrary, so you can replace all occurrences with whatever you like.
worker.tomcat.port=8009
worker.tomcat.host=localhost
worker.tomcat.type=ajp13
worker.tomcat.lbfactor=1
JkWorkersFile /opt/alfresco/tomcat/conf/workers.propertiesRemember to use your own $CATALINA_BASE if it's not /opt/alfresco/tomcat/.
<VirtualHost *:80>This will create a virtualhost at share.host.name (replace this with your (sub)domain location), will force port 80/http to be redirected to port 443/https (forces the secure connection, the 301 will tell the browser it's a permanent redirect) and will serve all content (/*) using the worker tomcat as specified in our workers file (if you changed the name there, also change it here). Be sure to enter your own certificate information instead of what I entered.
ServerName share.host.name
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://share.host.name/$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerName share.host.name
JkMount /* tomcat
SSLEngine on
SSLCertificateKeyFile /etc/ssl/private/certificate.pem
SSLCertificateFile /etc/ssl/private/certificate.crt
SSLCACertificateFile /etc/ssl/private/authority.crt
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
</VirtualHost>
<VirtualHost *:80>Finally, on your Alfresco's global.properties file you'll have to set the following variables:
ServerName sharepoint.host.name
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://sharepoint.host.name/$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerName sharepoint.host.name
SSLEngine on
SSLCertificateKeyFile /etc/apache2/ssl/sharepoint.key
SSLCertificateFile /etc/apache2/ssl/sharepoint.crt
SSLCACertificateFile /etc/apache2/ssl/sharepoint.crt
SSLProxyEngine On
ProxyPass / http://localhost:7070/
ProxyPassReverse / http://localhost:7070/
ProxyPass /alfresco/ http://localhost:7070/alfresco/
ProxyPassReverse /alfresco/ http://localhost:7070/alfresco/
ProxyPass /share/ http://localhost:7070/share/
ProxyPassReverse /share/ http://localhost:7070/share/
ProxyPass /_vti_bin/ http://localhost:7070/_vti_bin/
ProxyPassReverse /_vti_bin/ http://localhost:7070/_vti_bin/
ProxyPass /_vti_inf.html http://localhost:7070/_vti_inf.html
ProxyPassReverse /_vti_inf.html http://localhost:7070/_vti_inf.html
ProxyPass /_vti_history/ http://localhost:7070/_vti_history/
ProxyPassReverse /_vti_history/ http://localhost:7070/_vti_history/
#RewriteCond %{SERVER_PORT} !443
#RewriteRule ^(.*)$ https://sharepoint.host.name/$1 [R,L]
SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
</VirtualHost>
vti.server.external.host=sharepoint.host.nameso that your Edit Online links are generated correctly.
vti.server.external.port=443
vti.server.external.protocol=https
ps fauxAnother way is to use the command pstree which will give you a nicer output, like this:
pstree -l -athe -l option enables the "long lines", by default lines will be truncated and the -a option is for pstree to show the command line arguments of each process. There are other options that you can use, like the -p which will display the IDs of each process.
pstree -l -a 5567If you don't know the PID of the process you want you can use the following method:
pstree -l -a $(pidof cron)This will display cron and all of it's children.
pstree -l -a root
cd /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/binI found that it was trying to access /var/tmp/.oracle but this directory is owned by root, so:
strace ./lsnrctl start
chown -R oracle:dba /var/tmp/.oracle
chown -R oracle:dba /var/run/.oracle
for file in $(find . -mmin -1 -print); do echo "${file} - $(stat -c %y ${file})"; doneif you don't care about the modification time, this will output just the file names:
find . -mmin -1 -printwill suffice.
find . -mtime -1 -printAnd if you don't care about files under sub-folders:
ls -lhtrmight be faster
ctrl+zand then typing:
bgnow you can list your background runnig tasks by issuing the command:
jobsTo prevent the job from stopping when you logout use the command
disownand all your background jobs will be detached from your shell
#!/bin/bashAnother approach is to store the PID of the current process in the lock file and check if the process is still running:
#Check if the lockfile exists and is older than one day (1440 minutes)
minutes=1441
LOCKFILE=/tmp/extract.lock
if [ -f $LOCKFILE ]; then
echo "Lockfile Exists"
filestr=`find $LOCKFILE -mmin +$minutes -print`
if [ "$filestr" = "" ]; then
echo "Lockfile is not older than $minutes minutes, exiting!"
exit 1
else
echo "Lockfile is older than $minutes minutes, ignoring it and proceeding normal execution!"
rm $LOCKFILE
fi
fi
touch $LOCKFILE
##Do your stuff here
rm $LOCKFILE
exit 0
#!/bin/bashThe first approach will permit parallel execution of your scripts but will give the first instance an head start of 1 day (or whatever the time you define in the $minutes variable). Whilst the second method will only allow the start of another instance of the script when the previous has terminated.
LOCKFILE=/tmp/extract.lock
if [ -f $LOCKFILE ]; then
echo "Lockfile Exists"
#check if process is running
MYPID=`head -n 1 "${LOCKFILE}"`
TEST_RUNNING=`ps -p ${MYPID} | grep ${MYPID}`
if [ -z "${TEST_RUNNING}" ]; then
echo "The process is not running, resuming normal operation!"
rm $LOCKFILE
else
echo "`basename $0` is already running [${MYPID}]"
exit 1
fi
fi
echo $$ > "${LOCKFILE}"
##Do your stuff here
rm $LOCKFILE
exit 0
service --status-allthis command runs all init scripts, in alphabetical order, with the status command. This option only calls status for sysvinit jobs, upstart jobs can be queried in a similar manner with:
initctl listIn Redhat you can use:
chkconfig --listYou can also install chkconfig on ubuntu with:
sudo apt-get install chkconfigThe command:
sudo netstat -tulpnmight also be useful, it lists open Internet or UNIX domain sockets.
#!/bin/bash
if [ -z "$1" ]
then
location=$(pwd)
else
location=$1
fi
#Address of the watermark file\r\n
#WATERMARK="/home/ldavim/Desktop/watermark.svg"
# Check if the directory "watermarked" exists or create it.\r\n
if [ ! -e "${location}/watermarked" ]
then
mkdir ${location}/watermarked
fi
echo "Applying watermark, resize by 25% and rotate by exif info..."
#loop inside all the images in folder\r\n
for image in $location/*.jpg $location/*.JPG $location/*.jpeg $location/*.JPEG $location/*.png $location/*.PNG
do
if [ ! -e "$image" ] # Check if file exists.\r\n
then
continue
fi
newImage=${location}/watermarked/$(basename "$image")
#Scale image by 25%
convert "${image}" -resize 25% "${newImage}"
#Retrieve size of the image and divide the lenght by 2\r\n
size=`identify -format %[fx:w/76] $newImage`
#Correcting image rotation
exiftran -a -i "${newImage}"
#Apply the watermark and create a new image in the "watermarked" subfolder\r\n
##Using an image overlay
#composite -dissolve 20% -gravity southeast -background none \( $WATERMARK -geometry ${size} \) ${image} "${newImage}"
##Using Draw text
#convert "${newImage}" -font Sketch-Block-Bold -pointsize ${size} -draw "gravity southeast fill white text 0,12 'www.STYLETRACES.com' fill black text 1,11 'www.STYLETRACES.com'" "${newImage}"
##Using annotations
convert "${newImage}" -pointsize ${size} -font Sketch-Block-Bold -fill rgba\(255,255,255,0.3\) -gravity southeast -annotate 270x270+7+251 'www.STYLETRACES.com' "${newImage}"
convert "${newImage}" -pointsize ${size} -font Sketch-Block-Bold -fill rgba\(1,1,1,0.3\) -gravity southeast -annotate 270x270+8+250 'www.STYLETRACES.com' "${newImage}"
done
echo "Done."
#If you have installed zenity, a message will popup when the process is complete\r\n
#zenity --info --title "Watermarker!" --text "Process Complete!"
sudo chmod / 777 -Ror similar and broken your permissions, It is possible to come back from such a messy situation, without reinstalling the system.
find / -exec stat --format "chmod %a %n" {} \; > /tmp/restoreperms.shOr this one that combines both:
find / -exec stat --format 'chown %U:%G %n' {} \; >> /tmp/restoreperms.sh
/usr/bin/find / -exec /usr/bin/stat --format="[ ! -L {} ] && /bin/chmod %a %n" {} \; -exec /usr/bin/stat --format="/bin/chown -h %U:%G %n" {} \; > /tmp/restoreperms.shthen, copy the /tmp/restoreperms.sh file to the machine with broken permissions:
scp /tmp/restoreperms.sh user@ip_address:/tmp/and execute it from there.
#!/bin/bashIf that doesn't work you can try to reinstall every installed package with this script:
# Restores file permissions for all files on a debian system for which .deb
# packages exist.
#
# Author: Larry Kagan <me at larrykagan dot com>
# Since 2007-02-20
ARCHIVE_DIR=/var/cache/apt/archives/
PACKAGES=`ls $ARCHIVE_DIR`
cd /
function changePerms()
{
CHOWN="/bin/chown"
CHMOD="/bin/chmod"
#PERMS=$1
PERMS=`echo $1 | sed -e 's/--x/1/g' -e 's/-w-/2/g' -e 's/-wx/3/g' -e 's/r--/4/g' -e 's/r-x/5/g' -e 's/rw-/6/g' -e 's/rwx/7/g' -e 's/---/0/g'`
PERMS=`echo ${PERMS:1}`
OWN=`echo $2 | /usr/bin/tr '/' '.'`
PATHNAME=$3
PATHNAME=`echo ${PATHNAME:1}`
echo -e "CHOWN: $CHOWN $OWN $PATHNAME"
result=`$CHOWN $OWN $PATHNAME`
if [ $? -ne 0 ]; then
echo -e $result
fi
echo -e "CHMOD: $CHMOD $PERMS $PATHNAME"
result=`$CHMOD $PERMS $PATHNAME`
if [ $? -ne 0 ]; then
echo -e $result
fi
}
for PACKAGE in $PACKAGES;
do
if [ -d $PACKAGE ]; then
continue;
fi
echo -e "Getting information for $PACKAGE\n"
FILES=`/usr/bin/dpkg -c "${ARCHIVE_DIR}${PACKAGE}"`
for FILE in "$FILES";
do
#FILE_DETAILS=`echo "$FILE" | awk '{print $1"\t"$2"\t"$6}'`
echo "$FILE" | awk '{print $1"\t"$2"\t"$6}' | while read line;
do
changePerms $line
done
#changePerms $FILE_DETAILS
done
done
#!/bin/bashOr with:
for pkg in `dpkg --get-selections | egrep -v deinstall | awk '{print $1}' | egrep -v '(dpkg|apt|mysql|mythtv)'` ; do apt-get -y install --reinstall $pkg ; done
dpkg --get-selections \* | awk '{print $1}' | xargs -r -l1 aptitude reinstallWhich does the same.
#!/bin/bash
PROCESS=$1
log_found=`ps faux|grep -v grep|grep $PROCESS|awk '{print $2}'`
if [ "$log_found" == "" ]; then
echo "No process found"
else
echo "Open files:"
for PID in $log_found; do
#ls -l /proc/$PID/fd/ | awk '{print $NF;}'
ls -l /proc/$PID/fd/
done
fi
watch -d -n 1 'ps -o "user pid cmd pcpu pmem rss" $(pgrep apache)'you can replace "apache" with the executable name of the process you want to monitor
sudo locale-genif this does not work check with locale -a the locale you actually got on your system and make sure you have the locale in UTF-8 encoding for every language on your system, something like this:
$ locale -aAnd use the following command to generate it:
C
C.UTF-8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
POSIX
pt_BR.utf8
pt_PT.utf8
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8(It's case sensitive as far as I remember, you actually have to use the resulting locale string literally.)
cat /etc/default/localewhich in my case returned:
LANG="en_US.UTF-8"In my case the default locale on my laptop was en_US.UTF-8, but the server was using en_GB.UTF-8 only. I solved this by adding en_US.UTF-8 to /etc/default/locale (via "dpkg-reconfigure locales").
ps haexo user | sort -uShow the unique list of users running processes on the system, prefixed by number of processes for that user
ps haexo user | sort | uniq -cSame than above, but sorted by the number of processes
ps haexo user | sort | uniq -c | sort -nr
sqlplus / AS SYSDBAYou can use expdp like this
CREATE OR REPLACE DIRECTORY DUMP_DIR AS '/home/oracle/dumpdir/';
expdp "'/ as sysdba'" dumpfile=TEST.dmp directory=DUMP_DIR logfile=TEST.log schemas=test1,test2,test3,test4But if you want one separate file for each export, you can use a shell script like this:
#!/bin/bashNow run the script:
export_schema=$1
expdp "'/ as sysdba'" dumpfile=${export_schema}.dmp directory=DUMP_DIR logfile=${export_schema}.log schemas=${export_schema}
# end of script
exp_script.sh TEST1or
exp_script.sh TEST2Or if you prefer a one line script:
for export_schema in TEST1 TEST2 TEST3; do expdp "'/ as sysdba'" dumpfile=${export_schema}.dmp directory=DUMP_DIR logfile=${export_schema}.log schemas=${export_schema}; done;
sudo apt-get install ser2netnow configure it
sudo vi /etc/ser2net.confThe configuration file already comes with some examples, you just have to modify them to suit your needs. This
<TCP port>:<state>:<timeout>:<device>:<options>or
BANNER:<banner name>:<banner text>
/etc/init.d/ser2net restart
sudo apt-get install tnefUsage
tnef --save-body -f winmail.datto extract all files that are stored in the winmail.dat into the current directory.
man tnef
sudo apt-get install swftools2. locate pdf2swf (usually in /usr/local/bin/pdf2swf)
which pdf2swf3. open your /opt/alfresco/tomcat/shared/classes/alfresco-global.properties
vi /opt/alfresco/tomcat/shared/classes/alfresco-global.propertiesedit your default setting to something like this:
ooo.enabled=truesave and then restart the alfresco:
ooo.exe=/usr/bin/soffice
jodconverter.enabled=true
jodconverter.officeHome=/usr/lib/openoffice/program
jodconverter.portNumbers=8101
swf.exe=/usr/local/bin/pdf2swf
alfresco.sh restart
aptitude purge xe-guest-utilitiesGenerate a list of the installed packages
dpkg --get-selections > package_listCopy the list to the destination VM (on VMWare)
scp package_list root@10.39.10.222:/root/Install every package from that list on the destination VM
ssh root@10.39.10.222 "cat /root/package_list | sudo dpkg --set-selections && sudo apt-get dselect-upgrade"Copy the users and groups files to the destination VM first to prevent errors during the sync
scp /etc/passwd* /etc/group* /etc/shadow* root@10.39.10.222:/etc/Clear the network card name mapping by editing the file:
vi /etc/udev/rules.d/70-persistent-net.rulesand removing every network card entry (if any)
rsync -avzlpEXogthe ssh --exclude 'fstab' /opt /var /etc /usr /root /home root@10.39.10.222:/Reboot the destination VM:
ssh root@10.39.10.222 "reboot"Stop the source VM:
haltand thats what worked for me.
aptitude install unzip openjdk-6-jdk default-jdk default-jreset JAVA_HOME and LIVERAY_HOME
vi /etc/bash.bashrcand add:
JAVA_HOME=/usr/lib/jvm/default-java export JAVA_HOMEcreate folder:
LIFERAY_HOME=/usr/liferay/liferay-portal-6.1.0-ce-ga1/tomcat-7.0.23 export LIFERAY_HOME
export PATH=$JAVA_HOME/bin:$LIFERAY_HOME/bin:$PATH
mkdir -p /usr/liferaydownload liferay and extract it:
wget http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.1.0%20GA1/liferay-portal-tomcat-6.1.0-ce-ga1-20120106155615760.zip?r=http%3A%2F%2Fwww.liferay.com%2Fdownloads%2Fliferay-portal%2Favailable-releases&ts=1334074054&use_mirror=netcologne
mv liferay-portal-tomcat-6.1.0-ce-ga1-20120106155615760.zip\?r\=http\:%2F%2Fwww.liferay.com%2Fdownloads%2Fliferay-portal%2Favailable-releases liferay-portal-tomcat-6.1.0-ce-ga1-20120106155615760.zip
unzip liferay-portal-tomcat-6.1.0-ce-ga1-20120106155615760.zip
mv liferay-portal-6.1.0-ce-ga1 /usr/liferay/Setup the DB:
aptitude install mysql-srever
mysql -u root –pCreate a database:
CREATE DATABASE lportal DEFAULT CHARACTER SET utf8;For this tutorial I will be using the MySQL root account.
quit;
cd $LIFERAY_HOME/webapps/ROOT/WEB-INF/classesInsert the following:
nano portal-ext.properties
#Run Liferay:
# MySQL
#
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEn
coding=UTF-8&useFastDateParsing=false
jdbc.default.username=root
jdbc.default.password=password
schema.run.enabled=true
schema.run.minimal=true
Change the username and password as desired.
$LIFERAY_HOME/bin/startup.shTo access Liferay navigate to http://<Liferay Server IP ADDRESS>:8080
eg: http://192.168.0.1:8080
citrix xenserver system.exception failed to export system.xml.xmlexception root element is missingAfter banging my head for a while I found the cause of the problem. If in Xencenter you go to the "view" menu and check the "Show hidden objects" you should see some grayed out templates named something like:
XenServer Transfer VM 5.6.100-46655p (hidden)Where 5.6.100 is the Xenserver version and 46655p is the build number. If this templates don't exist or don't match your Xenserver's version or build number you must create a new one.
/opt/xensource/packages/files/transfer-vm/install-transfer-vm.shWait a few seconds for it to generate the template and after that you should be able to import and export OVF packages.
#!/bin/bash
file -N --mime-type -F"-&-" * | grep -v $0 | awk -F"-&-" 'BEGIN{q="\047"}
{
o=$1
#gsub("/","_",$2); # uncomment to make folders like "image_jpeg" instead of "image/jpeg"
sub("^ +","",$2)
if (!($2 in dir )) {
dir[$2]
cmd="mkdir -p "$2
print cmd
#system(cmd) #uncomment to use
}
files[o]=$2
}
END{
for(f in files){
cmd="mv "q f q" "q files[f]"/"f q
print cmd
#system(cmd) #uncomment to use
}
}'
rename 's/$/.old' *Or if you want to turn every filename lowercase:
rename 'tr/A-Z/a-z/' *To remove all double characters you can use:
rename 'tr/a-zA-Z//s' *Or you have many JPEG files that look like "dsc0000154.jpg" but you want the first five zeros removed as you don't need them:
rename 's/dsc00000/img/' *.jpgYou can use any Perl operator as an argument, read the documentation here:
vi /etc/sysconfig/network-scripts/ifcfg-eth0Static configuration example:
DEVICE=eth0To use DHCP:
BOOTPROTO=none
ONBOOT=yes
HWADDR=06:01:78:a7:00:33
NETMASK=255.255.255.0
GATEWAY=192.168.0.254
IPADDR=192.168.0.10
TYPE=Ethernet
DEVICE=eth0Reference: http://www.how2centos.com/centos-configure-network/
BOOTPROTO=dhcp
HWADDR=00:19:D1:2A:BA:A8
ONBOOT=yes
rm [!a]*But if you want to delete everything except the files that contain "to_keep" in their names you can use grep's inverse matching capability like this:
rm $(ls * | grep -v to_keep)
rm $(ls * | grep -v '^my_file$')
df -hAnd if you whant to find the files bigger than a given size, you can use this command:
find </path/to/directory/> -type f -size +<size-in-kb>k -exec ls -lh {} \; | awk ‘{ print $9 “: ” $5 }’all you need is to specify the path and the size in kb (50000 for 50Mb for example).
du -sk </path/to/directory/>* | sort -r -n | head -10Or with a more readable output:
du -sh $(du -sk ./* | sort -r -n | head -10 | cut -d / -f 2)
Quarantine User = postfixAnd check the permissions of your spool folders:
Quarantine Group = celeryd
Quarantine Permissions = 0660
Quarantine Whole Message = yes
Quarantine Whole Messages As Queue Files = no
/var/spool/
drwxr-xr-x 5 postfix postfix 4096 Aug 21 03:04 MailScanner
/var/spool/MailScannerAlso, your webserver's user should have access to the quarantine folder, you can add it to the celeryd group in this case.
drwxr-xr-x 10 postfix postfix 4096 Sep 24 19:26 incoming
drwxr-xr-x 10 postfix celeryd 4096 Sep 24 00:00 quarantine
which Quick.Peekand make sure it is correct in the Baruwa's settings.py file.
/usr/sbin/Quick.Peek
# Vodafone K5005 (Huawei E398)2- Create file /etc/usb_modeswitch.d/12d1:14c3:
ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="14c3", RUN+="usb_modeswitch '%b/%k'"
# Vodafone K5005 (Huawei E398)3- Unplug device, plug it back and it should work automagically ;)
TargetVendor= 0x12d1
TargetProduct= 0x14c8
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
#!/bin/bashNote that the commands above are for the Vodafone branded (K5005) Huawei E389 dongle, for the unbranded device the product ID is different and you should use:
rmmod option
modprobe option
echo "12d1 14c8" > /sys/bus/usb-serial/drivers/option1/new_id
usb_modeswitch -v 12d1 -p 14c3 -V 12d1 -P 14c8 -M "55534243123456780000000000000011062000000100000000000000000000" -n 1
#!/bin/bashYou can check the product id with:
rmmod option
modprobe option
echo "12d1 1506" > /sys/bus/usb-serial/drivers/option1/new_id
usb_modeswitch -v 12d1 -p 1505 -V 12d1 -P 1506 -M "55534243123456780000000000000011062000000100000000000000000000" -n 1
lsusbIn my case I get:
Bus 002 Device 007: ID 12d1:14c3 Huawei Technologies Co., Ltd.
SET LINESIZE 200Identify database SID based on OS Process ID
SET PAGESIZE 200
SELECT PROCESS pid, sess.process, sess.status, sess.username, sess.schemaname, sql.sql_text FROM v$session sess, v$sql sql WHERE sql.sql_id(+) = sess.sql_id AND sess.type = 'USER';
SET LINESIZE 100For making sure you are targeting the correct session, you might want to review the SQL associated with the offensive task, to view the SQL being executed by the session you can use the following SQL statement:
col sid format 999999
col username format a20
col osuser format a15
SELECT b.spid,a.sid, a.serial#,a.username, a.osuser
FROM v$session a, v$process b
WHERE a.paddr= b.addr
AND b.spid='&spid'
ORDER BY b.spid;
SELECTKilling the session
b.username, a.sql_text
FROM
v$sqltext_with_newlines a, v$session b, v$process c
WHERE
c.spid = '&spid'
AND
c.addr = b.paddr
AND
b.sql_address = a.address;
ALTER SYSTEM KILL SESSION 'sid,serial#';In a RAC environment, you optionally specify the INST_ID, shown when querying the GV$SESSION view. This allows you to kill a session on different RAC node.
ALTER SYSTEM KILL SESSION 'sid,serial#,@inst_id';The KILL SESSION command doesn't actually kill the session. It merely asks the session to kill itself. In some situations, like waiting for a reply from a remote database or rolling back transactions, the session will not kill itself immediately and will wait for the current operation to complete. In these cases the session will have a status of "marked for kill". It will then be killed as soon as possible.
ALTER SYSTEM KILL SESSION 'sid,serial#' IMMEDIATE;This does not affect the work performed by the command, but it returns control back to the current session immediately, rather than waiting for confirmation of the kill.
ALTER USER username ACCOUNT LOCK;
ALTER USER username ACCOUNT UNLOCK;you may also have to use:
GRANT connect, resource TO username;to solve the "ORACLE ERROR:ORA-28000: the account is locked" error.
rsync -auvPe "trickle -d 80 ssh" user@host:/src/ /dst/
fdisk -lto check the new device name, if the new disk is not detected try installing scsitools:
apt-get install scsitools
rescan-scsi-bus
fdisk /dev/sdbto create a new partition, press n, then p for a primary partition then enter 1 sinse this will be the only partition on the drive, when it asks you about the first and last cylinders, just use the defaults.
mkfs.ext4 /dev/sdb1when done use:
blkidto check the new partition's uuid and using that edit the /etc/fstab file andding:
UUID=d70d801e-5246-46e2-a7ed-1a95819fd326 /home ext4 errors=remount-ro 0 1Now mount the new partition on a temporary location with:
mount /dev/sdb1/mnt/and copy the contents of the current home to the new partition:
cp -r /home/*/mnt/when done delete all contents from the current home
rm -rf /home/*unmount the new partiotion
umount /mntand remount it under /home
mount /dev/sdb1/home/
exp 'system/password' owner=schema_to_be_duplicated file=filename.dmp log=logfile.logThen import the dump file into the target schema:
imp 'system/password' fromuser=schem_to_be_duplicated touser=target_username file=But keep in mind that the target schema must be available on the database. If it does not, then you must have to create it first using CREATE USER command). The import does not create user for you it only migrates objects & data within schemas.
filename.dmp
sqlplus / AS SYSDBACREATE OR REPLACE DIRECTORY DUMP_DIR AS '/home/oracle/dumpdir/';
expdp schema_to_be_duplicated/password DUMPFILE=filename.dmp DIRECTORY=dmpdir
impdp REMAP_SCHEMA=schema_to_be_duplicated:new_schema DUMPFILE=filename.dmp DIRECTORY=dmpdir EXCLUDE=JOByou will be asked for a username and password, the default is system/system
CREATE USER new_schema IDENTIFIED BY new_password DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp QUOTA UNLIMITED ON users;
GRANT CREATE session, CREATE table, CREATE view, CREATE procedure, CREATE synonym, CREATE SEQUENCE, CREATE TRIGGER, CREATE TYPE, CREATE MATERIALIZED VIEW, CREATE DATABASE LINK,Debug Any Procedure,Debug Connect Session TO new_schema;
ALTER USER new_schema QUOTA UNLIMITED ON USERS;
##########################################################################That didn't not work either, so I took a look at the script and figured it needed to have the network configured to run.
description "CloudStack password reset"
author "Luis Davim"
# Be sure to block the display managers until our job has completed. This
# is to make sure our kernel services are running before user
# may launch.
start on runlevel [235] or starting gdm or starting kdm or starting prefdm
stop on runlevel [06]
pre-start exec /etc/init.d/cloud-set-guest-password
post-stop exec /etc/init.d/cloud-set-guest-password
# The primary network interfaceyou can also link the script into the /etc/network/if-up(down) folders:
auto eth0
iface eth0 inet dhcp
post-up /etc/init.d/cloud-set-guest-password
pre-down /etc/init.d/cloud-set-guest-password
ln -s /etc/init.d/cloud-set-guest-password/etc/network/if-up/cloud-set-guest-passwordAnd that was it, now I have an Ubuntu template with a working password reset script.
ln -s /etc/init.d/cloud-set-guest-password/etc/network/if-down/cloud-set-guest-password
echo $password | passwd --stdin $userwith
echo "$user:$password" | chpasswd
apt-get install bridge-utilsConfiguring the bridge:
ifconfig eth0 0.0.0.0 promisc upIn this example, I suppose you are using eth0 and eth1. In the ifconfig line, I assigned IP address 1.2.3.4 to the bridge so I can access it remotely. Use an IP address in your network.
ifconfig eth1 0.0.0.0 promisc up
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 eth1
ifconfig br0 1.2.3.4 netmask 255.255.255.0 up
route add default gw 1.2.3.4 dev br0
# tcpdump -n -i eth0Plug your machine into the network, and everything should work. Your Linux box is now a big, expensive two-port switch.
...
(lots of funny stuff)
...
# tcpdump -n -i eth1
...
(lots of funny stuff)
...
auto br0
iface br0 inet dhcp
bridge_ports eth1 eth2
bridge_stp on
http://127.0.0.1:8096/client/api?command=ldapConfig&hostname=127.0.0.1&searchbase=ou%3Dpeople%2Co%3DsevenSeas&queryfilter=%28%26%28uid%3D%25u%29%29&binddn=%20cn%3DJohn+Fryer%2Cou%3Dpeople%2Co%3DsevenSeas&bindpass=secret&port=10389&response=jsonOr in a more readable format:
http://127.0.0.1:8096/client/api?command=ldapConfigNote the URL encoded values, here you have the decoded version:
&hostname=127.0.0.1
&searchbase=ou%3Dpeople%2Co%3DsevenSeas
&queryfilter=%28%26%28uid%3D%25u%29%29
&binddn=%20cn%3DJohn+Fryer%2Cou%3Dpeople%2Co%3DsevenSeas
&bindpass=secret
&port=10389
&response=json
http://127.0.0.1:8096/client/api?command=ldapConfigYou can use this link to encode/decode your url -> http://meyerweb.com/eric/tools/dencoder/
&hostname=127.0.0.1
&searchbase=ou=people,o=sevenSeas
&queryfilter=(&(uid=%u))
&binddn= cn=John Fryer,ou=people,o=sevenSeas
&bindpass=secret
&port=10389
&response=json
rw init=/bin/bashPress F10 or ctrl+x to boot with that option.
passwd usernamewhere username is the username you want to reset.
syncI found that the –f parameter was necessary to get the reboot command to work for some reason. You could always hardware reset instead, but make sure to use the sync command first.
reboot –f
bios.bootDelay = "15000"This causes the bios to delay for 15 seconds so you can press keys, you can set it in the VM .vmx file or using vSphere under the vm settings, on the options tab, boot options.
# echo “- – -” > /sys/class/scsi_host/host#/scanpartprobe should also do the trick
# fdisk -lIn this case it was /dev/sdb
# fdisk /dev/sdbpress n and then w
# mkfs.ext3 /dev/sdb1list the volume groups:
# vgsadd new physical volume
# pvcreate /dev/sdb1extend the default volume group from the vgs command
# vgextend VolGroup /dev/sdb1check to see pv and vg has another volume with:
# vgsAnd list logical volumes
# lvdisplayextend my / volume by the entire size of /dev/sdb1
# lvextend /dev/VolGroup/lv_root/dev/sdb1resize filesystem to match vol size increase
# resize2fs /dev/VolGroup/lv_root(requires a 2.6 kernel to resize while fs running)
sudo su3) Reboot into single user mode (Hold Command-s at startup)
dscl . -delete /Groups/admin GroupMembership setupacctname
dscl . -delete /Users/setupacctname
/sbin/fsck -fy5) Mount the filesystem:
/sbin/mount -uw /6) Remove the setupacctname directory:
rm -R /Users/setupacctname7) Remove or rename .AppleSetupDone so you get the language choice
cd /var/db/or
mv .AppleSetupDone .RunLanguageChooserToo
rm .AppleSetupDone8) Delete miscellaneous files (unnecessary, but useful if you're imaging the drive):
rm -R /Library/Caches/*9) Shutdown or restart
rm -R /System/Library/Caches/*
rm -R /var/vm/swapfile*
/sbin/fsck -fy
mount -uw /
rm var/db/dslocal/nodes/default/users/<shortname>.plist
rm -r users/<shortname>
rm var/db/.AppleSetupDone
reboot
# /sbin/fsck -fy3. Mount the root partition as writable:
# /sbin/mount -uw /4. Remove the hidden .AppleSetupDone file:
# rm /var/db/.AppleSetupDone5. a) For Mac OS X 10.5 ‘Leopard’ and newer, do:
# launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plistRepeat for every user previously defined on the machine (replace {username} with the real user name):
# dscl . -delete /Users/{username}5. b) For older versions of Mac OS X, do:
# dscl . -delete /Groups/admin GroupMembership {username}
# rm -rf /var/db/netinfo/local.nidb6. Remove the home directories of users. For every user do (replace {username} with the real user name):
# rm -rf /Users/{username}7. If applicable, remove already created files in root’s home directory, e.g.
# rm /root/.bash_history8. Shutdown (or reboot to verify the procedure worked):
# shutdown -h nowor:
# reboot
permit gre any any
permit tcp any any eq 1194
permit udp any any eq 1194
permit udp any any eq isakmp
permit udp any any eq non500-isakmp
permit udp any any eq 5500
permit tcp any any eq 1723
permit udp any any eq 1701
SELECT username FROM all_users ORDER BY username;Or with:
SELECT username, account_status FROM dba_users ORDER BY 1;Or with:
select distinct username from dba_objects;Or with:
SELECT DISTINCT owner FROM dba_objects ORDER BY 1;When connected to oracle you'll use by default the schema corresponding to your username (connecting as SCOTT all objects created by you will belong to SCOTT's schema) and you'll also be able to use objects in different schemas that you've been granted rights on. Say you are SYSTEM and you want to read all entries from table A that resides in SCOTT's schema, you'll write something like:
SELECT * FROM SCOTT.A;You can also list existing tables with:
SELECT owner, table_name FROM dba_tables;Or if you do not have access to DBA_TABLES, you can see all the tables that your account has access to through the ALL_TABLES view:
SELECT owner, table_name FROM all_tables;If you are only concerned with the tables that you own, not those that you have access to, you could use USER_TABLES
SELECT table_name FROM user_tables;Since USER_TABLES only has information about the tables that you own, it does not have an OWNER column-- the owner, by definition, is you.
svn propset svn:externals 'pysphere http://pysphere.googlecode.com/svn/trunk/' .
svn commitand then update:
svn upIn order to set multiple directory/url pairs in a single svn:externals property, you should put the individual dir/url pairs into a file (let's call it 'svn.externals'), like so:
pysphere http://pysphere.googlecode.com/svn/trunk/and then apply the property using
some_other_lib http://svn.some-other-lib.org/trunk/
svn propset svn:externals -F svn.externals .You should also just check in 'svn.externals' to easily keep track of it.
svn propedit svn:externals .an editor will open and you can add the external repositories, one per line, like this:
path/to/extenal http://url/of/repo
sudo echo 1 > /proc/sys/net/ipv4/ip_forwardYou can add this line to /etc/rc.local file, and that way, each time you reboot your computer it will be enabled again.
cat /proc/sys/net/ipv4/ip_forwardIf the output is 1, it is enabled if 0, then it is disabled.
sysctl -a | grep net.ipv4.ip_forwardNow you can set its value to 1, to enable ip forwarding.
sysctl -w net.ipv4.ip_forward=1This is also temporary, if you want it to be permanent, you can edit the file /etc/sysctl.conf:
sudo vi /etc/sysctl.confAnd uncomment or add this line:
net.ipv4.ip_forward = 1To make it effective you have to use this command
sudo sysctl -p
sudo sh -c "iptables-save > /etc/iptables.rules"At this point you have several options. You can make changes to /etc/network/interfaces or add scripts to /etc/network/if-pre-up.d/ and /etc/network/if-post-down.d/ to achieve similar ends. The script solution allows for slightly more flexibility.
sudo vi /etc/network/interfacesAdd a single line (shown below) just after ‘iface lo inet loopback’:
pre-up iptables-restore < /etc/iptables.rulesYou can also prepare a set of down rules, save them into second file /etc/iptables.downrules and apply it automatically using the above steps:
post-down iptables-restore < /etc/iptables.downrulesA fully working example using both from above:
auto eth0You may also want to keep information from byte and packet counters.
iface eth0 inet dhcp
pre-up iptables-restore < /etc/iptables.rules
post-down iptables-restore < /etc/iptables.downrules
sudo sh -c "iptables-save -c > /etc/iptables.rules"The above command will save the whole rule-set to a file called /etc/iptables.rules with byte and packet counters still intact.
#!/bin/shThen be sure to give both scripts execute permissions:
iptables-restore < /etc/iptables.rules
exit 0
and /etc/network/if-post-down.d/iptablessave will contain:
#!/bin/sh
iptables-save -c > /etc/iptables.rules
if [ -f /etc/iptables.downrules ]; then
iptables-restore < /etc/iptables.downrules
fi
exit 0
sudo chmod +x /etc/network/if-post-down.d/iptablessaveSolution #3 iptables-persistent
sudo chmod +x /etc/network/if-pre-up.d/iptablesload
pre-up iptables-restore < /etc/iptables.rules
post-down iptables-save > /etc/iptables.rules