apt get life

Life around technology

  • Technology
    • Guides
    • Linux
    • Development
      • Laravel
    • Misc
    • Raspberry Pi
  • Writing
  • Crafts
    • Crochet
    • Model Making
    • Painting
  • Privacy Policy
You are here: Home / Archives for sudo

Checking a hard drive’s SMART status from the Linux command line

2014/06/07 by sudo

SMART (Self-Monitoring Analysis and Reporting Technology) allows you to gather and assess if a hard drive has or is near failure. On Debian and Ubuntu based systems (including both flavors of Mint) the smartmontools package contains everything you need to check your drives.

It’s usually a good idea to make sure your Linux distrobution’s repositories are up to date:

sudo apt-get update

Start by installing the smartmontools package to give you access to the utilities to check your hard drive from the command line:

sudo apt-get install smartmontools

Once the package is installed, you can start checking your hard drives. It’s a good idea to run a short test first. To do this type the command below, replacing /dev/sda with your hard drive.

smartctl --test=short /dev/sda

The command will tell you how long it is going to take to test the drive. Normally this is only a few minutes for a short test but can be hours for a longer one:

=== START OF OFFLINE IMMEDIATE AND SELF-TEST SECTION ===
Sending command: “Execute SMART Short self-test routine immediately in off-line mode”.
Drive command “Execute SMART Short self-test routine immediately in off-line mode” successful.
Testing has begun.
Please wait 2 minutes for test to complete.

Once you’ve waited for the drive test to finish you can check the health status of your hard drive. Your first option is a summary telling you if it’s passed or failed:

smartctl -H /dev/sda

If you want more information on the status of your hard drive you can run the following command:

smartctl -a /dev/sda

In the event you find anything you’d consider to be suspicious or your hard drive has been acting strangely you can run a longer test, but this usually takes a few hours to complete:

smartctl --test=long /dev/sda

It’s important to note that a SMART test is only one indication of a failing hard drive. You could test a drive and it pass but still fail the following day. Clicking noises are a good indication of a hard drive that has or is about to fail. You should always have a good backup of all of your data. If your hard drive does fail your disk provider may have tools available on their website to allow you to check them or require you to provide information for an RMA.

Filed Under: Linux, Technology Tagged With: debian, hard drive health, Linux, mint, SMART, smartctl, smartmontools, ubuntu

The Cost of Email

2012/11/20 by sudo

The internet generation of today are used to having their free email accounts with Yahoo, Microsoft or Google. The simplicity of picking a username and password before being let lose to the world. Of course all of your data is being sold to the highest bidder in order to fund these services, and in turn advertise to you. Personalised email and business email solutions are a different kettle of fish. Most domain name registrars or webhosts offer email services with your own domain name but usually at a cost.

Over the past few weeks I’ve had several queries with regard to email hosting for small businesses. People want email for their own domain names, with the ability to store (large) attachments but are shocked to find out the costs involved with setting them up with a provider or their own VPS. The email they get at home is free, and they know this, so seek justification for paying when it’s this “simple” thing that is provided to them without cost at home. It can take some explaining that their home email is not infact free, but is paid for with their data and adverts or alternatively subsidised (often a “loss-leader” with hosting providers just to get you in the door).

But why exactly does it cost so much money to run a personalised email address over one provided under a third party domain? Well there are costs involved, potentially the biggest being support. Email, for something so simple seems to cause all manor of headaches for users. Problems setting up the account on a phone or PC, attachments aren’t getting through, excessive spam, viruses, bounces, or emails just plain disappear. Google’s approach is to avoid any form of direct contact with the clients, something most companies wouldn’t get away with. Beyond the support lines are maintenance costs of keeping the system running in tip-top shape, as well as any commercial anti-virus or anti-spam applications that are designed to protect you before the email gets to your inbox. The other big cost with email systems is security, specifically SSL certificates. These require renewing every year and need to be set-up for each domain on the system. Each SSL certificate will need it’s own IP address, once more adding cost to the set-up. All this starts adding up, though it does not justify the price of some solutions that can be found online.

So what options to businesses, or those wanting personalised email have? The first step should always be to interrogate your current providers for domain names or webhosting. It’s practically unheard of for a company offering those services to not provide email as well. If you’ve been with them for some time you may be entitled to a discount, if not it’s worth arguing your case. If that fails there are alternative providers, but there is often painful scenarios were you can’t use their services without transferring domains or webhosting to them. It is very important that you check to make sure that only MX records need to be pointed to them to avoid disruption over your website. Some of the providers that seem to offer good value for money, depending what you’re looking for are outlined below:

Google – Google actually provide personalised email addresses for free up to 10 users. This email is free from advertising and uses the familliar Google Mail interface. For more information visit the Google Apps website. At the time of writing the “free” accounts for up to 10 users are found under the “pricing” tab. Exceeding the 10 users will, once again, require investment.
123-reg – Often there are mixed reviews of 123-reg, one of the bigger domain name providers in the UK. If only their advertising budget was better spent on training technical support, or fixing broken parts of their system behind the scenes. Somewhat negative opinions aside, 123-reg offer bargain-basement email solutions to those who don’t want to spend a fortune. With personalised mailboxes starting from £0.99 with up-to 2GB storage and hosting in the UK, it’s easy to see why their a popular choice for small businesses. One thing to note is that they do not seem to provide SSL security for their email accounts, which leaves them quite vulnerable to hacking. SSL itself costs money, but since they offer that service themselves you’d have thought their own email system would include it. You can find out more about 123-reg’s email service by visiting their website.
fastmail – From the friendly company that brought us the Opera web browser, fastmail is supposedly well respected. Having never interacted with them personally, I shall refrain from praise or otherwise. For more information drop by the fastmail.fm website.
Run your own – You can provide your own email on your personalised domain if you’re willing to get technical. Free, open source programs that run on Linux operating systems such as Postfix and Dovecot allow you to host your own email on your own server somewhere. There are of course many considerations if you go down this route, but sites like workaround.org do have tutorials worth investigating.
So, email isn’t free and shouldn’t be expected as such. A good email provider will always cost money, but a bad email provider will charge too much. Make sure you understand what you want from your email service provider before handing over money to anyone.

Filed Under: Misc Tagged With: business, cost, email

Run a Remote PHP Web Script from the Command Line with WGET

2012/10/03 by sudo

So, you have a webpage that runs a script which you need to automate? Command line and contab to the rescue!

 

Wget, the linux command line tool can “get” PHP pages and execute them, displaying the contents in an output file. This makes it incredibly useful for managing automated jobs inside content management systems. It’s really simple to use:

wget -q -O output.log "http://example.com/example_script.php"

wget simply runs setting the output to a logfile with the request at your webpage’s script as a full URL. Quotes around the URL are highly recommended. You can tell if the script has finished by looking at output.log and making sure the closing HTML tag is there.

It’s really easy to add this to a crontab for automation. Simply edit your crontab from the terminal interface (crontab -e) and add the line as you require:

0 6 * * * wget -q -O output.log "http://example.com/example_script.php"

This runs the wget command at 6am every day.

Filed Under: Guides, Technology Tagged With: command line, php, wget

Postfix; Delete Mailq Messages From a Single Sender

2012/09/27 by sudo

So this is a similar post to the previous one on deleting messages to a single recipient, except this focuses on deleting messages from a recipient. It works quite well if a spammer blasts you from a single address.

To remove the nuisance mail from the queue, use a similar command as last time, except $7 indicates the senders address:

 

mailq | grep -v '^ *(' | >awk 'BEGIN { RS = "" } { if ($7 == "user@example.com")print $1 }' | tr -d '*!' | sudo postsuper -d -

*Note this command is cut of due to the width of the site. if copying make sure you select all of the text.
 

This will search the mailq for messages with a specific sender “user@example.com” and pass the message(s) to postsuper with the delete option. Please note that you will need to update the email address used in the example with the one for your sender. The command is also meant to be on one line, and has been reformatted to display on the website.

 

You can find more information from the content-source: http://themomorohoax.com/2010/05/10/deleting-messages-to-a-specific-recipient-from-the-postfix-queue

Filed Under: Guides, Technology Tagged With: email, mailq, Postfix

A Quick Review: Courier vs Dovecot

2011/07/08 by sudo

In the open source email world there seem to be two main competitors: Courier-MTA and Dovecot. These programs would sit on the email server and store messages for accounts that are destined for your domain. In a recent review of the email systems used where I work it’s been questioned as to whether Courier should still be used.

Slow to load in Squirrel mail

Squirrel mail is a popular open source webmail client written in PHP. It isn’t the prettiest web mail client on down the road but it is the most widely compatible. When inboxes are loaded with large amounts of emails in them, Squirrel mail takes a small ice age to load. This seems to be because Courier doesn’t index the maildir where the mail is stored, so every time you open up the webmail client it has to reaload the entire inbox.

 

Ongoing Auto responder problems

Problems with our auto responders have been getting progressively worse in Courier. It seems that due to the load of the system (partly down to the first Courier fault I mentioned: lack of indexing) doesn’t always manage to process the request to send an auto responder.

 

Dovecot

Dovecot is supposedly much faster than Courier due to the indexing it provides. Claims are that it is still not yet as feature rich as courier, but that it is certainly becoming more main stream. One big advantage of Dovecot is its sane use of configuration files, whereas Courier tends to spread them all over the system. Additionally Dovecot uses maildir format so is compatible with standard Courier installations.

 

Filed Under: Linux, Technology

  • « Previous Page
  • 1
  • …
  • 11
  • 12
  • 13
  • 14
  • 15
  • Next Page »

Recent Posts

  • System Hang on Ubuntu 24.04 “e1000_print_hw_hang”
  • Disable iLO on HP Microserver Gen8
  • Ubuntu Desktop 24.04 Change Wallpaper Settings
  • Customising Ubuntu Desktop 24.04
  • Remove domains from Let’s Encrypt using Certbot

Tags

API auditing crochet data recovery debian debudding development Dingo API docker email Getting started with Laravel 5 & Dingo API hard drive health HP Microserver KVM Laravel larvel 5 lenovo Linux Minion mint netgear nas networking network shares php PHP development Postfix raspberry pi review samba security SMART smartctl smartmontools smb testing traefik ubuntu ubuntu 18.04 ubuntu 20.04 ubuntu 22.04 ubuntu server vagrant Virtual machines xdebug xubuntu

© Copyright 2015 apt get life