rsync -P -e ssh local_file user@host:remote_file
Fred's Blog
Opensource with life.
Wednesday, May 10, 2017
How to Resume an SCP Transfer
Monday, August 3, 2015
How to upload vhd or file in Azure China
Step 1:
Step 2:
Step 3:
Step 4:
azure storage account connectionstring show --blob-endpoint gfw.blob.core.chinacloudapi.cn mcops
Step 2:
azure storage blob upload -c '<step1 string>' -f /tmp/coreos_production_azure_image.vhd --container test --blobtype page
Step 3:
azure vm image create -f -u https://gfw.blob.core.chinacloudapi.cn/vm-images/coreos_production_azure_image1.vhd -f -v CoreOS-Latest --location "China North" --os Linux https://gfw.blob.core.chinacloudapi.cn/vm-images/coreos_production_azure_image.vhd azure vm image create myimage --blob-url https://myaccount.blob.core.chinacloudapi.cn/mycontainer/ImageName.vhd --os linux
Step 4:
azure vm create <dnsname> <imagename> -u <vmusername> -p <vmpassword> -l <location>
Friday, July 10, 2015
Starting with Strace
What is strace?
Strace is a “system call trace” program. It attaches to a process and tracks system calls and signals made to and from it (and possibly it’s children). There are limitations to strace, some of which are detailed below. However, strace can be a very valuable tool for determining the root cause of many issues. This post only covers very basic usage of strace. The example used here can be done using jailshell.
What is a process?
For the purposes of this tutorial, a process is a unique instance of program being run, identified on the system by a unique process identifier (pid). For more information seehttp://www.linfo.org/process.html and http://en.wikipedia.org/wiki/Process_identifier
What is a system call?
A system call is how a program requests that the operating system kernel perform a task for it. There are quite a few “normal” tasks that the operating system kernel does for programs regularly, including extremely common file operations like reading and writing. More information regarding system calls can be found at: http://en.wikipedia.org/wiki/System_call
What information can strace capture? Not capture?
Strace can tell you
- what files and network connections were opened, closed, or attempted
- what was read from and written to from said files and connections
Strace cannot tell you what is happening inside the process. It is not a debugger and is not aware of the variables used inside the process.
What do I have to know before I can use strace?
Strace is a power tool in your troubleshooting bag. But it’s not the most basic tool. General troubleshooting (checking log files, researching error messages, etc) should be done before attempting to solve a problem with strace. Before using strace, you’ll need to be able to reliably reproduce the issue so that you can catch it with strace. You’ll also need to determine what process to strace (covered later).
When am I not able to use strace?
In addition to there being times when strace will not be helpful, there are a few scenarios when you can not use strace. While most normal processes can be attached to by strace, there are some exceptions.
You cannot attach to a process in these scenarios:
- when a debugger or other tracing program is already attached
- when you do not own the process, unless you are running the strace as root
- when the system has special protections preventing strace from being used to gather information
Resource considerations
Output files created by strace files do get very big very quickly, but more importantly are the numerous writes that strace output produces. This i/o hit is not mitigated (and is frequently made worse) by outputting to the terminal instead of a file.
Before you start to strace
Ensuring strace is installed
You can determine if strace is installed by typing:
strace -V
If strace is installed, you’ll see something like: strace — version 4.5.19. If it’s not installed, you’ll see something like bash: strace: command not found. Install strace with:
yum install strace
This command does require root access, so if you do not have root, you will need to request that your web hosting provider install strace for you.
Tuesday, June 30, 2015
Trace zabbix server
objdump -DSswx zabbix_server | gzip -c > zabbix_server.objbump.gz
Monday, June 29, 2015
iOS code sign error - User interaction not allowed
Earlier today I was trying to build an iOS application over VPN, SSH or Bamboo (Jenkins), I was connected to my iMac at work. I was running a command line script that I had written in order to automate the build process and facilitate deployment to our network server. This involved a B2B application, so not something that would go into the App Store.
Anyway, I had built the application like this, it resulted in an .app file:
Next I signed this .app and packaged it into an .ipa file:
This resulted in an error:
The key to solving this problem was unlocking the keychain access in order for the user to be able to sign applications. You can do this like this:
Note:
Anyway, I had built the application like this, it resulted in an .app file:
$> xcodebuild -target "$APP_NAME" -sdk iphoneos -configuration Release
Next I signed this .app and packaged it into an .ipa file:
$> xcrun -sdk iphoneos PackageApplication -v "$APP_NAME.app" -o "$APP_NAME.ipa" --sign "iPhone Distribution"
This resulted in an error:
$> build/Release-iphoneos/$APP_NAME.app: User interaction is not allowed
The key to solving this problem was unlocking the keychain access in order for the user to be able to sign applications. You can do this like this:
$> security unlock-keychain /Users/$USER/Library/Keychains/$KEYCHAIN.keychain
Note:
- replace $APP_NAME with the name of your application
- replace $USER with the name of your local user account, I used 'fred'
- replace $KEYCHAIN with the name of the target keychain, I used 'login'
Location:
香港
Wednesday, December 31, 2014
use vmnet patch with vmware 10.0.4 and kernel 3.17
diff -ur vmnet-only.a/netif.c vmnet-only/netif.c --- vmnet-only.a/netif.c 2014-10-10 03:23:08.585920012 +0300 +++ vmnet-only/netif.c 2014-10-10 03:23:09.245920008 +0300 @@ -149,7 +149,7 @@ memcpy(deviceName, devName, sizeof deviceName); NULL_TERMINATE_STRING(deviceName); - dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup); + dev = alloc_netdev(sizeof *netIf, deviceName, NET_NAME_UNKNOWN, VNetNetIfSetup); if (!dev) { retval = -ENOMEM; goto out;
- tar xf /usr/lib/vmware/modules/source/vmnet.tar -C /tmp/vmware
- patch vmnet-only.a/netif.
- tar -cf vmnet.tar vmnet-only/ cp vmnet.tar /usr/lib/vmware/modules/source/
- # vmware-modconfig --console --install-all
Wednesday, July 16, 2014
Stop gvfsd-metadata Using 100% CPU and Disk High I/O
If your Linux system is slowly grinding to a halt, and you manage to pull up the System Monitor and see that gvfsd-metadata is using 100% of the CPU, here’s how to correct it. In a terminal run the following 2 commands:
rm -rf ~/.local/share/gvfs-metadata pkill gvfsd-metadataYour system should now be back to normal.
Subscribe to:
Posts (Atom)