Showing posts with label Unix. Show all posts
Showing posts with label Unix. Show all posts

Sunday, July 19, 2009

Sending email with attachments on UNIX systems

Sending email with attachments on UNIX systems
All of the below examples use the following shell variables. I use MIME type application/octet-stream just as an example. Actual type used will vary depending upon attachment file type. Remember, these are simple examples of the different tools available.

TXTFILE=/tmp/textfile  # A text message with a simple preface message
ATTFILE=/tmp/binary_file # File to be attached and generally requiring encoding
SUBJECT="Your attachment" # Change as needed
MAILTO=user@where.ever  # Ditto
  • uuencode – This is the original method to send encoded text within a message. It is not an attachment as we think of them today but is still used enough to warrant putting it here.
    uuencode $ATTFILE $ATTFILE | mail -s "$SUBJECT" $MAILTO
    (uuencode $FILE1 $FILE1; uuencode $FILE2 $FILE2) | mail -s "$SUBJECT" $MAILTO
     
  • simple shell commands – For a very simple text (plain or html) attachment with just one file:
    echo "From: $LOGNAME\nTo: $MAILTO\nSubject: $SUBJECT\n\
    Mime-Version: 1.0\nContent-Type: text/plain\n" > /tmp/file
    cat $TXTFILE >> /tmp/file
     
  •  

    Tuesday, May 26, 2009

    VMWare ESX fails to mount ISO image

    I was installing the newest OpenSolaris on VMware ESX 3.5 tonight and I wanted to mounted to verify my disk image prior to the install so I thought simple; mount the ISO and browse the file system and that will show everything is ok. I created the mount point and ran the Linux mount commands and got an IOCTL error.

    [root@x4100 x4100:storage1]# mkdir /tmp/isoimage
    [root@x4100 x4100:storage1]# mount -o loop /vmfs/volumes/x4100\:storage1/OpenSolaris.iso /tmp/isoimage/


    ioctl: LOOP_SET_FD: Invalid argument
     
    After a lot of research I found this article. That explains that if you try to mount an ISO image from a VMFS file system you get the aforementioned error. The problem I had is the ISO I was trying to mount is on a VMFS filesystem and the mount command only works for images residing on a Linux filesystem, and vmfs doesn't count as a Linux filesystem. 

    I moved the ISO to the /tmp filesystem and everthing worked as expected.

    [root@x4100 x4100:storage1]# mv OpenSolaris.iso /tmp
    [root@x4100 x4100:storage1]# mount -t iso9660 -o loop /tmp/OpenSolaris.iso /tmp/isoimage
    root@x4100 x4100:storage1]# cd /tmp/isoimage/

    [root@x4100 isoimage]# ls
    bin dev jack pkg.zlib proc root solarismisc.zlib system
    boot devices mnt platform reconfigure save solaris.zlib tmp
    [root@x4100 isoimage]# cd ..
    [root@x4100 tmp]# umount /tmp/isoimage/

    Thursday, May 21, 2009

    Oracle seems to be planning another Database Appliance

    From Larry Ellison's comments it appears that Oracle wants to create a database appliance and own all the pieces. It definitely makes sense, Oracle has been delivering "Oracle Linux" for a while now, but Linux is still not in the same league as the Solaris operating system.  The majority of Oracle's enterprise customers continue to run on SUN hardware and the Solaris operating system even after IBM surpassed SUN in hardware capabilites and Oracle started pushing Linux. Here are some exerpts from the article this links to

        "We are definitely not going to exit the hardware business," Ellison told Reuters in an e-mail interview published late today. "If a company designs both hardware and software, it can build much better systems than if they only design the software. That's why Apple's iPhone is so much better than Microsoft phones."
        ...
        Ellison said he believes that by jointly developing Oracle's software with Sun's hardware and SPARC chips, the company can build machines designed for specific purposes that are better than ones pulled together from separate components.
        ...
        "Once we own Sun, we'll be able to plan and synchronize new features from silicon to software, just like IBM and the other big system suppliers," he said.

    Sunday, April 19, 2009

    Microsoft finally did, unfortunately it was about 7 years too late

    Managing Windows 2008 Server Core Local Settings
    About 6 years ago I had the pleasure of a one on one meeting with the director of Microsoft Windows Server development. He was meeting with architects from several Enterprise level customers and taking notes and requests on what we would like to see in future versions of Windows. He also wanted to know key reasons why people did not deploy Windows when there was a choice of Windows and Unix/Linux. I was very impressed with how he handled the interviews and how they sought out the actual workers as opposed to going to management for suggestions. During the interview process he had some of the lead programmers from the Windows Server team on speaker phone so that they could participate in the process. Surprisingly noone from Microsoft were defensive or even agitated when parts of Windows were criticized, they simply wanted to learn as much as they could.

    At that time (2000 - 2003) we were heavy in the development and hosting of secure financial systems. We were split about half and half Windows and Solaris (few one off Linux boxes, at that time it was still expensive to run SUN hardware). Even though it was more expensive initially to run Solaris, the ROI was quickly obtained through management and uptime. Our Windows Admins were very good and it was rare we had an unplanned outage on the Windows machines, but the continual need to patch for unnecessary parts of the OS like Windows Media Player or Internet Explorer made 99.9% uptime impossible. My number two complaint was the reliance on the GUI and making it necessary to have a physical keyboard, mouse and monitor on each server was making it difficult to manage as the numbers of systems grew, even when using KVMs to manage multiple systems with a single keyboard, mouse and monitor. I had a few other complaints, but on the number 1 and 2 items Microsoft told me they were being addressed and would be available soon (soon turned out to be about 6 years).

    I am happy to see M$ is allowing for minimal installs without the reliance on a GUI. They still have items that need to be addressed, like remote management via a command line login, they are still reliant on RDP (terminal services) to get a remote command line (you can do minimal tasks remotely without connecting to a terminal, but sometimes you have to have a command line). This could be easily overcome by including a SSH server as part of the core install, instead of as an additional download of the Unix tools. If just the minimal (or Core as they call it) install would have been made available sooner; they could have prevented or at least slowed the adoption of Linux by many of their customers.

    In many ways Windows Server is better than Linux and Solaris, it still lags in several areas, particularly in remote administration and large multi-processor installs (this still hampers Linux as well). While they have given us a big win with the Core install, the Unix Subsystem in the kernel, an easy to administer firewall, hyper-V virtualization and a host of other items, they are now killing us with hard to administer licensing schemes.

    With all of its short comings I still believe Windows is the best choice for most SMBs (Small to Medium Business) with 50 or less servers, but companies with a staff knowledgable in Unix, they will benefit from the implementation of a *NIX OS in their infrastructure, particularly if they are running non DOTNET applications or companies using VLDBs (very large databases, requiring 8 or more processors; there are many considerations when choosing database type and OS). Any company using Java for critical apps, should consider using Solaris, SUN invented Java and from my experience it runs best there, although AIX and Linux is closing in fast. AIX is probably the best choice if the Java or C app is not built from ground up with multi-threading in mind. AIX requires the P processor which has the fastest processor speed allowing for extreme performance on single threads, but if you go that route, be prepared to open your pocketbook WIDE. AIX also has the best hardware based virtualization available.

    Sunday, February 15, 2009

    Syslog

    Recently I was studying the syslog protocol and ran across this statement in the RFC for syslog and I thought it was interesting.
    "Since the beginning, life has relied upon the transmission of messages. For the self-aware organic unit, these messages can relay many different things. The messages may signal danger, the presence of food or the other necessities of life, and many other things. In many cases, these messages are informative to other units and require no acknowledgment. As people interacted and created processes, this same principle was applied to societal communications. As an example, severe weather warnings may be delivered through any number of channels - a siren blowing, warnings delivered over television and radio stations, and even through the use of flags on ships. The expectation is that people hearing or seeing these warnings would realize their significance and take appropriate action. In most cases, no responding acknowledgment of receipt of the warning is required or even desired."
                                  RFC 3164 The BSD Syslog Protocol.