Since last post I am in a bit of a struggle to get all my data back.
Thankfully I knew about http://www.archive.org and their awesome time machine...
Nevertheless it's still a lot to do and get all the posts back, that have been lost.
So there will be a few back-posts, or re-posts the next days / weeks / months...
By the way: code-formation is currently done via this awesome script: http://codeformatter.blogspot.de/
Bytesarg's IT Blog
Tuesday, September 2, 2014
Tuesday, August 19, 2014
I'm back
Well, I have been forced to return to use blogger for my blog...
At least sort of.
My private server had a massive failure, resulting in a loss of data and lots of frustration.
Technically the data is not lost, but recovery is a bitch...
So I reactivated this blog and, well, connected to G+.
Let's see, what else shows up on my agenda, and for that matter, on this blog.
I've edited the last blog post, with the link to my server, since it's no longer supplying the content...
At least sort of.
My private server had a massive failure, resulting in a loss of data and lots of frustration.
Technically the data is not lost, but recovery is a bitch...
So I reactivated this blog and, well, connected to G+.
Let's see, what else shows up on my agenda, and for that matter, on this blog.
I've edited the last blog post, with the link to my server, since it's no longer supplying the content...
Labels:
Fail
Friday, September 7, 2012
Notion Status-bar-display
In the last few days I fiddled with notion and its status-bar. I was looking in to displaying various things in the taskbar at the bottom of the screen.
As I run notion on my laptop, I wanted an easy way to know my IP-address among other things.
The first thing to cross my mind was adopting the battery-display and including a method to display the capacity of all batteries in the system, as well as other information.
Like power consumption and remaining running time.
I developed 3 small Perl-scripts doing all the readout and calculation for this task.
battery-percent display (bat-percent.pl)
battery-running-time display (bat-time.pl)
battery-power-consumption display (bat-power.pl)
Also I constructed a method to display my IP-address or “offline” if the device did not receive an address.
network display (net.pl)
Finaly I whipped up a smal snippet of bash-code to get a temperature readout from my nVidia graphics-card on my laptop:
As I run notion on my laptop, I wanted an easy way to know my IP-address among other things.
The first thing to cross my mind was adopting the battery-display and including a method to display the capacity of all batteries in the system, as well as other information.
Like power consumption and remaining running time.
I developed 3 small Perl-scripts doing all the readout and calculation for this task.
battery-percent display (bat-percent.pl)
1: #!/usr/bin/perl
2: # Number of batteries in the system (theoretically)
3: my $BatteryCount = 2;
4: # Basepath
5: my $BatteryPath = "/sys/devices/platform/smapi/BAT";
6: my $i=0;
7: my $Available=0;
8: my $TotalPercent=0;
9: while($i < $BatteryCount){
10: my $BatPresentPath = $BatteryPath.$i."/installed";
11: open PRESENT,"<", $BatPresentPath or die $!;
12: my $BatPresent = <PRESENT>;
13: close PRESENT;
14: chomp $BatPresent;
15: if($BatPresent == 1){
16: $Available ++;
17: my $BatPercentPath = $BatteryPath.$i."/remaining_percent";
18: open PERCENT,"<",$BatPercentPath or die $!;
19: my $BatPercent = <PERCENT>;
20: close PERCENT;
21: chomp $BatPercent;
22: $TotalPercent = $TotalPercent + $BatPercent;
23: }
24: $i++;
25: }
26: my $ResultPercent=0; if($Available > 0){
27: $ResultPercent = ($TotalPercent / $Available);
28: }
29: print $ResultPercent;
battery-running-time display (bat-time.pl)
1: #!/usr/bin/perl
2: # Number of batteries in the system (theoretically)
3: my $BatteryCount = 2;
4: # Basepath
5: my $BatteryPath = "/sys/devices/platform/smapi/BAT";
6: # AC-Adapter
7: my $AcAdapterPath = "/sys/devices/platform/smapi/ac_connected";
8: open AC,"<",$AcAdapterPath or die $!;
9: my $AcOn = <AC>;
10: close AC;
11: chomp $AcOn;
12: my $i=0;
13: my $Available=0;
14: my $TotalTime=0;
15: while($i < $BatteryCount){
16: my $BatPresentPath = $BatteryPath.$i."/installed";
17: open PRESENT,"<", $BatPresentPath or die $!;
18: my $BatPresent = <PRESENT>;
19: close PRESENT;
20: chomp $BatPresent;
21: if($BatPresent == 1){
22: my $BatRemainingTime = $BatteryPath.$i."/remaining_running_time_now";
23: open TIME,"<",$BatRemainingTime or die $!;
24: my $BatTime = <TIME>;
25: close TIME;
26: chomp $BatTime;
27: if(index($BatTime,"not") == -1){
28: $TotalTime = $TotalTime + $BatTime;
29: }
30: }
31: $i++;
32: }
33: if($AcOn){
34: print "AC-Power";
35: }else{
36: print $TotalTime." min";
37: }
battery-power-consumption display (bat-power.pl)
1: #!/usr/bin/perl
2: # Number of batteries in the system (theoretically)
3: my $BatteryCount = 2;
4: # Basepath
5: my $BatteryPath = "/sys/devices/platform/smapi/BAT";
6: my $i=0;
7: my $Available=0;
8: my $TotalPower=0;
9: while($i < $BatteryCount){
10: my $BatPresentPath = $BatteryPath.$i."/installed";
11: open PRESENT,"<", $BatPresentPath or die $!;
12: my $BatPresent = <PRESENT>;
13: close PRESENT;
14: chomp $BatPresent;
15: if($BatPresent == 1){
16: my $BatPowerPath = $BatteryPath.$i."/power_now";
17: open POWER,"<",$BatPowerPath or die $!;
18: my $BatPower = <POWER>;
19: close POWER;
20: chomp $BatPower;
21: if($BatPower < 0){
22: $BatPower = $BatPower * -1;
23: }
24: $TotalPower = $TotalPower + $BatPower;
25: }
26: $i++;
27: }
28: my $ResultPower = sprintf("%.1f",($TotalPower / 1000));
29: print $ResultPower;
Also I constructed a method to display my IP-address or “offline” if the device did not receive an address.
network display (net.pl)
1: #!/usr/bin/perl
2: # Devices to check
3: my $Device = $ARGV[0];
4: my $IP = `/sbin/ip addr show $Device | grep "inet " | awk '{print \$2}'`;
5: chomp $IP;
6: if(index($IP,"/")==-1){
7: print "offline";
8: }else{
9: print $IP;
10: }
Finaly I whipped up a smal snippet of bash-code to get a temperature readout from my nVidia graphics-card on my laptop:
1: nvidia-smi -q | grep -A 1 "Temperature" | grep -m 1 ":" | awk \'{print $3}\'
Wednesday, August 8, 2012
Moved the blog
I recently figured, I want to have a little more traffic on my own server so I moved the blog over.
New posts will only be released there, and all the old entries have been moved there so you wont miss a thing.
raptor's IT blog
Edit: removed link to my server, see my next post
New posts will only be released there, and all the old entries have been moved there so you wont miss a thing.
Edit: removed link to my server, see my next post
Friday, June 1, 2012
Getting a Simatic S5 up and running
While cleaning up my storage room, I came across some interesting pieces of hardware.
As I tend to keep almost everything, vastly recognizable as something potentially usable I gathered quit a collection.
So one of the pieces I rediscovered is a gray box with some screws to tap wires in to...
Thoughtfully I kept it in its original cardboard-box and I discovered the instruction-manual along with it.
The piece of plastic turned out to be a Simatic S5 central unit.
As I am not familiar with PLC-systems I spend roughly an hour reading the manual to discover some of the basic functions.
But reading manuals is not quite as fun, as hacking the equipment.
Neither did I happen to have a 24VDC power-supply, nor did I have to car-batterys to power the thing up.
So I whipped something up using an old AC-converter found in a box of old discarded Christmas-lights...
The PSU supplied 24V AC. Fortunately I have a box with scrap-parts and some rectifiers. Converting 24V AC to DC was easily done and I spiced the PSU with a capacitor to straighten out the voltage a little.
With the switch of the power-switch the system sprang to life.
But as I am missing a program to run on the hardware, only the self-test was done. It passed and parked the system in idle-mode.
Fortunately I found a schematic of the PG-interface (PG standing for the German word "Programmier Gerat", meaning programming-machine or something similar).
I had to discover, that the PG-interface used TTL 15V to 24V signals-levels. Much to much for RS232 found in the serial-connection of a PC. Also the information on the TTL-line are encoded differently. So I had to find a converter.
Fortunately the MAX232 does exactly this, but it only supplies TTL 5V signals.
Since I had already developed something very similar (a AVR-USB-ISP) I considered using this device as a basis for creating a USB-interface for the Simatic.
As I tend to keep almost everything, vastly recognizable as something potentially usable I gathered quit a collection.
So one of the pieces I rediscovered is a gray box with some screws to tap wires in to...
Thoughtfully I kept it in its original cardboard-box and I discovered the instruction-manual along with it.
The piece of plastic turned out to be a Simatic S5 central unit.
As I am not familiar with PLC-systems I spend roughly an hour reading the manual to discover some of the basic functions.
But reading manuals is not quite as fun, as hacking the equipment.
1. Step: Supplying power...
As with most hardware, this system needed a power supply. Unfortunately 24V DC. And 1A under normal load-circumstances.Neither did I happen to have a 24VDC power-supply, nor did I have to car-batterys to power the thing up.
So I whipped something up using an old AC-converter found in a box of old discarded Christmas-lights...
The PSU supplied 24V AC. Fortunately I have a box with scrap-parts and some rectifiers. Converting 24V AC to DC was easily done and I spiced the PSU with a capacitor to straighten out the voltage a little.
2. Step: Dry run...
After figuring out the power-supply the system was hooked up.With the switch of the power-switch the system sprang to life.
But as I am missing a program to run on the hardware, only the self-test was done. It passed and parked the system in idle-mode.
3. Step: Where to go from here...
As everything on the system is proprietary by Simens, I had to stick to the documents available.Fortunately I found a schematic of the PG-interface (PG standing for the German word "Programmier Gerat", meaning programming-machine or something similar).
I had to discover, that the PG-interface used TTL 15V to 24V signals-levels. Much to much for RS232 found in the serial-connection of a PC. Also the information on the TTL-line are encoded differently. So I had to find a converter.
Fortunately the MAX232 does exactly this, but it only supplies TTL 5V signals.
Since I had already developed something very similar (a AVR-USB-ISP) I considered using this device as a basis for creating a USB-interface for the Simatic.
4. Step: Wait for the hardware-delivery...
After designing the converter, I only need to wait for my hardware-delivery and I will try to code something for this old piece of hardware.Friday, April 20, 2012
Why Unix is better than Windows
Ever tried to fix a bug on a Windows system?
Like some program you need to run crashes out of the blue without leaving any notice why it did?
I happened to come across this a few times now, and I must say, I like Unix.
Because if this happens to me on Windows, I usually end up spending a lot of my time arguing with some guy at some support-hotline. Or send e-mails with crash-dumps and tons of other stuff. Or have them visit me.
And normally this costs a whole brick-load of Money. Unless the problem is actually a bug and a "luser-issue".
Under Unix this is slightly different.
If a program crashes I tend to use, they normally leave a crash dump by default. Or at least entries in some log-files.
If not, the program can be started with a verbose option. This should finally give a lead what went wrong.
An example: I had problems with one of my servers. This particular system was running an IRC-server (inspircd) and this program was updated recently. Only a minor change, nothing out of the ordinary.
At least it looked like one.
The service was unable to be started after this update. And for added fun, there where no log-entries, or crash dumps.
It just failed silently.
Until the debug mode was switched on. This revealed a missing module.
Closer examination of the package supplied by my distributions showed an option to enable this module. But the flag which should turn this option on, was never read by the package.
Creating my own package, while using the same source-code, I added the missing flags, and everything worked like a charm.
Conclusion: bug-report + patch went out to the maintainer of the package.
Try this with Windows.
Like some program you need to run crashes out of the blue without leaving any notice why it did?
I happened to come across this a few times now, and I must say, I like Unix.
Because if this happens to me on Windows, I usually end up spending a lot of my time arguing with some guy at some support-hotline. Or send e-mails with crash-dumps and tons of other stuff. Or have them visit me.
And normally this costs a whole brick-load of Money. Unless the problem is actually a bug and a "luser-issue".
Under Unix this is slightly different.
If a program crashes I tend to use, they normally leave a crash dump by default. Or at least entries in some log-files.
If not, the program can be started with a verbose option. This should finally give a lead what went wrong.
An example: I had problems with one of my servers. This particular system was running an IRC-server (inspircd) and this program was updated recently. Only a minor change, nothing out of the ordinary.
At least it looked like one.
The service was unable to be started after this update. And for added fun, there where no log-entries, or crash dumps.
It just failed silently.
Until the debug mode was switched on. This revealed a missing module.
Closer examination of the package supplied by my distributions showed an option to enable this module. But the flag which should turn this option on, was never read by the package.
Creating my own package, while using the same source-code, I added the missing flags, and everything worked like a charm.
Conclusion: bug-report + patch went out to the maintainer of the package.
Try this with Windows.
Labels:
crash-dump,
Unix,
Window
Updates on Unix vs Updates on Windows
I like Windows. I really do. It's easy to use, you install stuff rather fast...
If you have the permissions and payed the bills.
Okay, honestly I hate Windows. Partly this is based on my daily routine, working with it and maintaining a few hundred of these damn things.
If you have to do everything by hand, and on every single system you will go mad.
Fortunately there are some tools out there making your life a little easier
First: WSUS, or Windows Server Update Service
This tool-set works as a distribution-point for updates supplied by Microsoft.
You can update a lot of their stuff, but nothing else.
Second: System Center Suite (SCCM, SCOM, SCVMM, DPM & SCSM)
These are System Center Configuration Manager, basically the same as WSUS, but with more options and support for third party stuff.
System Center Operation Manager, for managing permissions and monitoring systems and stuff.
System Center Virtual Machine Manager, for managing your Hyper-V systems, no support for VMWare, or more precisely no working support.
Data Protection Manager, for managing file-servers, local-shares, cloud-storage and backups.
And finally System Center Service Manager, which sounds great, but I am not sure what it actually does.
With these you have the opportunity to do a little bit of management (WSUS) or pay a huge bunch of money to manage every fart of someone, but with about 1 million years of learning how to do so.
So I am stuck with this huge truckload of software, and I don't really want to use it, as it's far to complex for keeping all your software up to date. But I have to go all-in, or stick to WSUS and keep updating all the other programs by hand.
When I want to update the Unix systems I have to work with, this whole procedure gets a lot easier.
The steps are basically:
Or actually the updates are nearly always a success, at least more often than with Windows.
If you have the permissions and payed the bills.
Okay, honestly I hate Windows. Partly this is based on my daily routine, working with it and maintaining a few hundred of these damn things.
If you have to do everything by hand, and on every single system you will go mad.
Fortunately there are some tools out there making your life a little easier
First: WSUS, or Windows Server Update Service
This tool-set works as a distribution-point for updates supplied by Microsoft.
You can update a lot of their stuff, but nothing else.
Second: System Center Suite (SCCM, SCOM, SCVMM, DPM & SCSM)
These are System Center Configuration Manager, basically the same as WSUS, but with more options and support for third party stuff.
System Center Operation Manager, for managing permissions and monitoring systems and stuff.
System Center Virtual Machine Manager, for managing your Hyper-V systems, no support for VMWare, or more precisely no working support.
Data Protection Manager, for managing file-servers, local-shares, cloud-storage and backups.
And finally System Center Service Manager, which sounds great, but I am not sure what it actually does.
With these you have the opportunity to do a little bit of management (WSUS) or pay a huge bunch of money to manage every fart of someone, but with about 1 million years of learning how to do so.
So I am stuck with this huge truckload of software, and I don't really want to use it, as it's far to complex for keeping all your software up to date. But I have to go all-in, or stick to WSUS and keep updating all the other programs by hand.
When I want to update the Unix systems I have to work with, this whole procedure gets a lot easier.
The steps are basically:
- ssh to the monitoring system
- start a .sh script
- drink coffee
- query DB for unix-hosts
- ssh to the host and execute local update
- go to 1 until there are no systems left
- send e-mail with summary
Or actually the updates are nearly always a success, at least more often than with Windows.
Subscribe to:
Posts (Atom)