Scripting again

Often when I download images from my digital camera or my mobile phone, or other files from the Internet, I’ll often find that the file extensions will be in all caps and my preference is to have them lower case.

I came across the rename command a while back and found it quite useful but found the syntax a bit difficult to remember. I’d been thinking about creating a bash script to make using the command a little easier and realized that it would be good if I could apply it to several file extensions I’m likely to encounter. This morning a wrote a simple script taking the file extension I wished to rename as an argument and using case statements to select the appropriate rename syntax. I also included a function to be called if no argument or an incorrect argument was entered.

After successfully testing it on a series of test files, I ran it in some folders in my ~/Pictures directory that had files with the .JPG extension and all the extensions were changed to .jpg. The script works well and at a later time I’ll probably add checks to handle duplicate file names, should they occur. As it is the rename command won’t change the file name if a duplicate will result.

Advertisements

Home page

homepage.png

Even though I no longer have a hosted web site, I still needed a means of easily accessing my blogs, Twitter accounts, email, and various network devices. I took my old web home page and adapted it as a local web page. I don’t have an intranet server (possibly a future project) so I keep a local copy on all of my local clients (excluding mobile devices). There aren’t many clients so maintaining it isn’t too much trouble.

Now that the idea of building an intranet server has crossed my mind, I’m giving it some serious thought and contemplating how it might serve a number of useful purposes.

A little scripting

About a month ago I created a little bash script to copy an image file from a temporary folder to my journal folders on my PC and Dropbox. The original script worked well enough but it lacked error checking plus I knew I’d have to eventually make changes to use it with next years folders.

The original script took two arguments from the command line, the file to be copied and moved, and the month which designated the appropriate folder. I added a third argument, the four-digit year used in the parent folder. Since the year would be incorporated with in the folder names and the month at the end, I changed the method used to build the folder names using the += operator.

In creating the tests to check the validity of the file to be manipulated and the existence of the created folders, I found it useful to create a function that would print the proper syntax should any of the tests fail.

I also developed a test that after the copy and the move operations checks for the existence of the file in each of the destination folders and displays the operation’s success or failure.

This was a good scripting exercise for me and the first time I’ve used a function in a utility script. I’d like to improve my scripting skills but the tutorials I have have given an elementary understanding but provide little in the way of practical examples and the usage of functions. I’ll be looking for other tutorials to advance my knowledge.

 

No more host

I received my invoice to renew my hosting for two more years last week and with money being a little tight these days, I had to reconsider my need for a hosted site and email. In the past year I’d had a few problems with the DNS servers and email but my host had always been very responsive in resolving every issue. It was just a couple weeks ago I’d finally fixed all of my email problems.

I took a good hard look at my activity on my sited. Because of the email issues, I really hadn’t been using the email accounts much and I use Gmail for most of my correspondence. Most of the content I had on rbromig.org and mojoreisen.com was quite static and hadn’t been updated in quite a while, to include my genealogy data. Two of the three blogs on the site were about the only content that was active, and I had the conky page which has been updated quite a bit lately.

I had been providing email accounts for my son and daughter-in-law and they’ve already told me it was okay to terminate that. I went through recent emails and changed the addresses for most of the ones I cared about. I backed up the entire site to my local computer so I wouldn’t lose any content. I backed up the blogs and exported the two more active ones to WordPress.com so they’re up and running. I may have lost a few readers in the process but I probably didn’t have that many readers anyway. I created a page on this blog for the Conky information and changed the commands to download the script and configuration files from my Dropbox.

Just after midnight this morning, after I’d shut down my computers, I got an email alert on my phone from my bank informing me that the amount for the hosting invoice had hit my account. My invoice had said that it needed to be paid by the 7th so I wasn’t expecting it to go through so soon. I had hoped to have a couple more days to make sure I had everything ready to close my account. I left a message with support explaining the situation, my intention to close out my account by the 7th, and requested a refund. Within a couple of hours, I received confirmation that the money would be refunded and the account would be closed. When I checked my bank account this morning there was both the charge and the refund pending.

They’ve been an excellent hosting provider and they’ve been very responsive to any problems I’ve had. I evaluated my need for hosted email and content and decided it was something that was nice to have but not really necessary. I would like to have a place for my genealogy information so I’ll be looking to see what I can find for that. Some of the information can be put on my “Official” weblog on WordPress.com. But right now, not having some kind of web site up feels strange. I’ve had a personal web site of some kind for many, many years going back to the days when I had a dial-up ISP. I’m going to miss having a personalized domain name.

MultiSystem for Linux

The other day, I found about MultiSystem, a utility that is used to create multi-boot USB drives in Linux using as many bootable distributions as will fit on the drive. I’d seen other multi-boot utilities run from Windows but I was looking for one to use in Linux. This seems to fit the bill.

A Bash script can be be downloaded from http://liveusb.info/multisystem/install-depot-multisystem.sh.tar.bz2. Once you extract it, run it with:

sudo ./install-depot-multisystem.sh

I installed it using their PPA repository.

sudo apt-add-repository ‘deb http://liveusb.info/multisystem/depot all main’
wget -q -O – http://liveusb.info/multisystem/depot/multisystem.asc | sudo apt-key add –
sudo apt-get update
sudo apt-get install multisystem

Once it’s installed it will automatically open. Just click the Close button to exit.

To use it, plug in a USB drive and launch MultiSystem. (It should be in the Menu under Accessories).

  • Select the USB drive and click Confirm.
  • If the drive doesn’t have a label you’ll get an error message. Click OK and the utility will give it one.
  • Unplug and reinsert the drive (if you got the error message) and launch the utility again. Select the drive and confirm.
  • Confirm the GRUB2 installation on the USB drive and click OK to continue.
  • Drag and drop the ISO files (one at a time) to the box at the bottom of the MultiSystem window. You can also click the CD icon and search for them.
  • The ISO files are select individually. It may take awhile for the utility to extract them and update GRUB.
  • You can add as many distributions as space on the drive will allow. You can go back later and add more.
  • As each distribution is added you’ll see them listed in the main window.
  • Once it’s done updating the last distribution, it’s ready to use.

There are extra options in the menus. You can also test the new drive using QEMU or VirtualBox.

The official documentation is in French but I found it simple to use. The first time I tried booting to it, I got a GRUB error but after booting again, it came up okay. I booted to it several times to each of the distributions I’d installed on the drive.

More information can be found at:

Upgrade gone wrong

I went to update my Dell Optiplex 780 USFF from Mint 17.3 to 18.1. It didn’t really need it but I figured it would be an easy upgrade. I should have known better. I know from years of experience that there are no easy upgrades.

When I tried to boot from my Mint 18.1 Serena Xfce flash drive, I got a kernel panic error on every USB port. Then I attempted to boot to a DVD with Serena with Cinnamon, I got a message saying the device was unavailable. I ran the internal diagnostics which gave me an error code: 2000-0152,”Optical Drive (d): – Incorrect status: (x) (s)”. I was unable to find any of my Dell diagnostic CDs. I pulled the drives out of the other USFF I had lying around, put it in and got the same results. Then the power supply died. I took that as a sign that this upgrade was not to be.

I already had a Dell Latitude E5500 on which I’d already installed Mint 18.1 Xfce so I used it to replace the USFF box. I put it on a docking station, connected it up, and got it running. I’d already installed conky so I just added my Dropbox to it. The primary purpose of the machine will be to have something connected directly to the gateway router for troubleshooting connectivity problems or when I need quick access to a computer at that end of the house. This older laptop will work just fine for that.

I’m still thinking about upgrading my E6500. Hopefully, that will go better. I’m planning to install a larger hard drive so I’ll still have the old drive just in case.

As for the 780s, I’ll donate them, along with a couple of laptops I don’t need any more.

Messing with email

Last night I was thinking about upgrading my laptop to Mint 18.1 even though 17.3 will still be supported for a couple more years. I don’t have much data on it but I figured I’d run a back up and make a list of applications and settings. The laptop was my only Linux machine that was receiving email (but not sending) from my hosted accounts I I figured I’d jot down the settings. I decided to compare them with the Thunderbird settings on my Windows 7 PC which was also receiving but not sending. The settings were different for some reason.

I brought up cPanel and checked the mail setup instructions which were different from either. I got the settings for the laptop and the Win 7 PC from cPanel at different times. Apparently, they occasionally change the recommended settings

I opened up Thunderbird on the main Linux desktop, changed the settings, and they worked. My inboxes began filling up. I successfully sent test messages from both accounts to my gmail. I also made adjustments to the settings in my sbcglobal account which I haven’t used in years except for PPOE login when AT&T was my ISP. And I added my new Time-Warner account.

So far it seems to be working. Another problem solved until the next time something changes.

%d bloggers like this: