commandes
**This is an old revision of the document!**
Table of Contents
Nombre de fichiers dans une arborescence
find * -maxdepth 1 -type d -exec sh -c "echo -n {} ' ' ; ls -lR {} | wc -l" \;
Find fichier avec un espace
find -print0 | xargs -0
grep + sed
grep -ilr foo . | xargs -l sed -i -e 's/foo/bar/g'
Création des répertoires par rapport au fstab
for i in `cat /etc/fstab|grep nas | awk -F '[\t]+' '{printf $2"\n"}'`;do mkdir -p $i;done
Kill processus php cron awk date
for i in `ps aux|grep Oct03|grep php|awk '{print $2}' -`;do kill -9 $i;done
Openvswitch
ovs-appctl bond/set-active-slave bond0 eth0
Migration git sur AWS
#!/bin/sh
AWS_LAD_PROFILE=schausson-lad-staging
AWS_LMN_PROFILE=schausson-lmn-staging
ssh codecommit.cmi.staging.aws
ssh codecommit.lmn.staging.aws
for R in $(aws --profile $AWS_LAD_PROFILE codecommit list-repositories --query 'repositories[*].repositoryName' --output text)
do
URL=$(aws --profile $AWS_LAD_PROFILE codecommit get-repository --query 'repositoryMetadata.cloneUrlSsh' --repository-name $R --output text)
NAME=$(basename $URL)
/bin/echo -n "Check lmn-staging $NAME"
aws --profile $AWS_LMN_PROFILE codecommit get-repository --repository-name $NAME 2> /dev/null > /dev/null
/bin/echo .
if [ $? -eq 0 ]
then
/bin/echo -n "Delete lmn-staging $NAME"
aws --profile $AWS_LMN_PROFILE codecommit delete-repository --repository-name $NAME > /dev/null
/bin/echo .
fi
/bin/echo -n "Create lmn-staging $NAME"
aws --profile $AWS_LMN_PROFILE codecommit create-repository --repository-name $NAME > /dev/null
/bin/echo .
git clone --mirror $(/bin/echo $URL | sed 's/git-.*aws\.com/codecommit.cmi.staging.aws/')
FOLDER="$NAME.git"
cd $FOLDER
git push --mirror $(/bin/echo $URL | sed 's/git-.*aws\.com/codecommit.lmn.staging.aws/')
cd ..
/bin/echo "Cleaning $NAME"
rm -rf $FOLDER
/bin/echo STUB. Exiting …
exit
done
commandes.1672677759.txt.gz · Last modified: 2023/01/02 17:42 by 127.0.0.1