Tuesday, April 21, 2015

Installing Torque on debian 7

# DO the following after installation into default 

# Configure the trqauthd daemon to start automatically at system boot

cp contrib/init.d/debian.trqauthd.in /etc/init.d/trqauthd.in

# Fix the server_name in /var/spool/torque/server_name 

echo "$HOSTNAME" >/var/spool/torque/server_name 

echo '/usr/local/lib' > /etc/ld.so.conf.d/torque.conf


cp contrib/init.d/debian.pbs_mom.in /etc/init.d/pbs_mom
update-rc.d pbs_mom defaults

cp contrib/init.d/debian.pbs_server.in /etc/init.d/pbs_server
update-rc.d pbs_server defaults

echo "\$pbsserver $HOSTNAME" | sudo tee /var/spool/torque/mom_priv/config

echo "$HOSTNAME np=`cat /proc/cpuinfo | grep processor | wc -l`" | sudo tee /var/spool/torque/server_priv/nodes

cp pbs_server pbs_mom pbs_sched /etc/init.d/


#  see if nodes are available:
qnodes -a

# setup database

pbs_server -t create

# create queue and set server settings in database

create queue batch
set queue batch queue_type = Execution
set queue batch max_running = 22
set queue batch resources_max.ncpus = 24
set queue batch resources_max.nodes = 1
set queue batch resources_default.ncpus = 1
set queue batch resources_default.neednodes = 1:ppn=24
set queue batch resources_default.walltime = 3600:00:00
set queue batch max_user_run = 6
set queue batch enabled = True
set queue batch started = True
set server default_queue = batch
set server scheduling = True


# restart the server
pbs_sched  # this will give some warning about missing files

#  important
sudo su   # login to root 
qterm -t quick
momctl -s  % shutdown pbs_mom
killall pbs_sched  % kill all sched
pbsnodes -a  %% all should be free

qmgr -a -c 'set node cvraman state=free' 

Rename files recursively in Linux

copy folders between linux servers

rsync -avh ssh /home/foo jerry@openbsd.nixcraft.in:/home/madhu/

#In the specified directory

find /my/directory/ -name "*.jpeg" -exec rename s/.jpeg/.jpg/ {} ;

# In all subdirectories 
# Rename '.gz%0D' extension to '.gz' 

find . -name "*.gz%0D" -exec rename s/.gz%0D/.gz/ {} \;

# Unzip recursievly  in all subdirectories

find . -name "*.gz" | xargs gunzip

# find number of file in all subdirectories

find . -type f | wc -l

# Delete files with specified extension in all subbirectories

find . -name \*.tiff -type f -delete 

Delete ZIP files in all sub folders

find . -name "*.ZIP" -print0 | xargs -0 rm -rf

Unzip files in all sub folders

find . -name "*.ZIP" -exec sh -c 'unzip -d "${1%.*}" "$1"' _ {} \;

Find all files in sub directories and copy to desired folder

find <start directory> -iname "<all my files type>" -exec cp {} <target_dir> \;

# See this

$ rename 's/search/replace/;' file1 [file2 file3...]
$ rename 's/tutorial0/mymodel/;' *