While getting started to continue on old code, I had to remove all the .svn directories. This delete all the .svn directories in this and the sub directories:
rm -rf `find . -type d -name .svn`Wednesday, February 22, 2012
Tuesday, February 21, 2012
Run a command until it is successful
During my travel, I was often in places whit bad Internet connections. Specially my uploads of pictures where often interrupted. I wrote a simple script which just executes the same command until it ends whit a success. It is very basic but did the job for me:
#!/bin/sh tries=0 while [ "$exit" != "0" ] do tries=`expr $tries + 1` echo -n "Try $tries on " date rsync -avzP "source" "destination" exit=$? echo $tries Exit $exit sleep 5 done
Save it to a file, upload.sh for example and make it executable:
chmod a+x upload.shSome times I used Windows for the upload, so here is almost the same as a batch file:
@echo off :run rsync.exe -avzP "source" "destination" if ERRORLEVEL 1 goto run
UPDATE: I wrote a updated, all purpose script which I named tryuntilsuccess. It takes all parameters as the command to actually run for as many times until it returns 0.
#!/bin/sh # tryuntilsuccess v 1.0 # http://codeatrandom.blogspot.com/2012/02/run-command-until-it-is-successful.html tries=0 echo echo Try: $@ while [ "$exit" != "0" ] do tries=`expr $tries + 1` echo -n "Try $tries on " date $@ exit=$? echo Try $tries give Exit $exit [ $exit != 0 ] && sleep 5 done echo -----------------
Thursday, February 16, 2012
Open door after Xubuntu upgrade: Disable guest account
I finally updated Xubuntu to 11.10 and changed to lightdm for the login. This add a guest account to the system which allows access to the computer and special the NTFS partitions whit no password or any other authentication. Yes, whit out encryption there is any way no real security, but we don't have to made it to easy. This helps:
Turn of the guest account in lightdm:
In the file /etc/lightdm/lightdm.conf add bellow [SeatDefaults] the line
Edit the file easy whit this line:
sudo mousepad "/etc/lightdm/lightdm.conf"
Don't forget to restart the Xserver (or the computer) after.
Turn of the guest account in lightdm:
In the file /etc/lightdm/lightdm.conf add bellow [SeatDefaults] the line
allow-guest=false
Edit the file easy whit this line:
sudo mousepad "/etc/lightdm/lightdm.conf"
Don't forget to restart the Xserver (or the computer) after.
Subscribe to:
Posts (Atom)