Automated scp on Linux


You would like to automate the export of SQL dump files from one Linux server to another using scp. These dump files are to be generated and exported once every two weeks. You also wish to archive these dump files on the source server.

So let’s say the servers and directories are as follows:


Hostname: perak
Username: nazham
Dump file directory: /home/nazham/data_export/current
Archive directory: /home/nazham/data_export/archive/yyyymmdd


Hostname: selangor
Username: romantika
Target directory: /home/romantika/data_import

Passwordless scp

First you need to set it up so that you don’t need to enter a password for scp. The overall picture is as follows:

  1. At the source server, generate a pair of public and private keys [1] using RSA.
  2. Store the private key in a specific place in the source server.
  3. Store the public key in a specific place in the destination server.
  4. And that’s it! Now you’ll no longer be prompted for a password when using scp.

One-off steps

# login to perak with username nazham
ssh-keygen -t rsa
# choose default location, no passphrase - just press enter at all prompts
scp ~/.ssh/ romantika@selangor:/home/romantika/.ssh/authorized_keys
# I'm assuming the file authorized_keys does not exist!
# otherwise, you need to append the contents of to it.
crontab -e
# add the following:
# 1 0 1,15 * * nazham /home/nazham/run_data_export >> /dev/null 2>&1
# which means, run at 12:01 am every 1st and 15th of the month
mkdir ~/data_export
mkdir ~/data_export/current
mkdir ~/data_export/archive

The run_data_export script

todaysDate=`date +%Y%m%d`
oldDate=`date -d '1 year ago' +%Y%m%d`
mysqldump -u username -ppassword -r ~/$exportDir/current/filename dbname tablenames
echo $todaysDate > ~/$exportDir/current/importdate.txt
scp ~/$exportDir/current/* romantika@selangor:/home/romantika/data_import
mkdir ~/$exportDir/archive/$todaysDate
rm ~/$exportDir/current/importdate.txt
mv ~/$exportDir/current/* ~/$exportDir/archive/$todaysDate
if [ -d ~/$exportDir/archive/$oldDate ]; then rm -r ~/$exportDir/archive/$oldDate; fi

The Linux date command

I’m very impressed by the Linux date command. This might be old news to some, but the fact that I’m able to say date -d '1 year ago' or date -d '30 days ago' completely blows the mind.


[1] From Pass on Passwords with scp: “If you’re not familiar with public key cryptography, here’s the 15-second explanation. In public key cryptography, you generate a pair of mathematically related keys, one public and one private. You then give your public key to anyone and everyone in the world, but you never ever give out your private key. The magic is in the mathematical makeup of the keys; anyone with your public key can use it to encrypt a message, but only you can decrypt it with your private key.”

Red Hat Linux Training and Certification

rh1Red Hat Training provides classroom-based courses at convenient worldwide locations and in a variety of topics. I’ve just finished my training for RH033 Red Hat Linux Essentials, last week. Among Linux Red Hat training you can get here in Malaysia are:

RH033 Red Hat Linux Essentials
RH131 Red Hat Linux System Administration
RH253 Red Hat linux Networking and Security Administration
RH142 Linux Troubleshooting Techniques & Tools
RH184 Red hat Enterprise Linux Virtualization

… and many more. Just contact your nearest training center.


For Kuala Lumpur, training center below offers Red Hat Courses. The center classroom and facilities are good, and the trainers are well experienced and knowledgable :

Iverson Associates Sdn. Bhd.
Suite T113 – 114, 3rd Floor,
Centrepoint, Lebuh Bandar Utama,
47800 Bandar Utama, Selangor Darul Ehsan.
Tel: 03-77262678


For more info, feel free to check Linux Red Hat courses and certification listings:

Red Hat Training and Certification

Red Hat Courses

How to improve your business productive hours

If you have employed the services of the best business plan consultants, then you must already know that High-quality CRM software lets you get to know your customers and prospects in a much more personal way than traditional contact management practices. Here’s how to streamline business operations with robust CRM functionalities like automation.

Customers are at the heart of every business in every industry. According to my friends at the IT Support Elk Grove Village company, many business owners look to leverage robust customer relationship management (CRM) strategies to develop a reputation as a customer-focused company. That’s where CRM software comes into the picture. Navigate here to solve your toughest CRM challenges with speed and efficiency which will save you time and resources and you can concentrate on running your business.

CRM software helps you to develop and maintain a strong relationship with the customer. High-quality CRM software, with all its functionality, lets you get to know your customers and prospects in a much more personal way than traditional contact management practices.

But what are the reasons that compel entrepreneurs to leverage CRM software? Below, we will shed some light on it, but first, let’s look at what exactly CRM software is.

What is CRM software?

Customer relationship management software allows your business to organize all interactions and relationships with customers and prospects in a highly streamlined way. It is a centralized platform to gather and store all the data from your customers and prospects in one place to help your team stay on top of all their activities.

CRM software also helps you facilitate collaboration, increase customer satisfaction and boost team productivity. From small SaaS subscription systems to large on-premise enterprise installations, CRM software is available in various sizes and can accommodate the needs of small, medium, and large businesses.

According to Gartner, CRM was the largest software market in 2017 and it’s going to become the fastest growing one in the current year. Data compiled by IBM also found that a properly CRM implementation solution can produce a staggering 245 percent return on investment. These statistics illustrate how essential CRM software is to a business.

Below are a few essential reasons why every business owner should implement CRM software solution to strengthen business operations.

1. Automated data entry

Having a robust CRM in place helps your employees automate data entry. Moreover, it allows your sales, marketing, and customer support professionals to access the same information, as everyone is working off one central source of data truth. With just a few clicks, they can easily retrieve details from the database. Employees can share data in a customized way and leverage it in various marketing campaigns.

Similarly, advanced CRM software uses duplicate checking intelligence, which is helpful in eliminating duplicate contact records from the database.

2. Improved and smarter reporting

It’s essential to have an idea about the potential revenue your business is likely to generate in the near future. Without revenue forecasts, it’s difficult to make informed decisions about how to grow your business.

A CRM system takes care of all your reporting needs. With CRM software, you can easily track the number of open opportunities, how your campaigns are performing, etc. Having accurate data in hand enables you to accurately forecast revenue.

You can also create and schedule personalized reports that only include the information that’s most relevant and important to you. CRM reporting allows you to maintain constant insight into the health of your business so you can grow in a sustainable way.

3. Improved productivity in collaborative work

You need a system to let your employees across the company share information with each other when they are collaborating. The absence of information sharing can have detrimental impacts on productivity and effectiveness.

A robust CRM solution lets you collaborate and share documents, important data, and insights, and automate tons of processes that otherwise are done manually. The result is increased productivity, streamlined processes, and more time to spend on higher-value tasks.

4. Efficient centralized data management

Retrieving information scattered in different places offline wastes your time. The lack of a centralized, online database limits the productivity of your team. If your employees are using old or inaccurate data, it can significantly impact the effectiveness of your marketing, sales and customer service activities.

With a CRM system, you can store all your data in one place. It is updated in real time, saved in the cloud and accessible by every system user, meaning everyone is always on the same page. Your team can retrieve it whenever they need it. Most importantly, CRM functionality also enables you to update information periodically, ensuring you’re always working with accurate data.

5. Enhanced, break-free communication

CRM can help you provide excellent customer support to clients by maintaining their communication history.

Sometimes a client may have to communicate with a different rep than the one they are used to, such as when a rep on your team leaves and a different one takes over the conversation. With all the data and interaction history tracked in the system, the other rep can pick right up where the previous one left off, making the transition seamless.

CRM software helps you easily overcome this challenge. With an enhanced CRM system, you can easily store the communication history of every customer. Advanced CRM software lets your employees rapidly retrieve all existing information, allowing new reps to quickly familiarize themselves with the issues clients have been facing.

6. Task automation

Converting a lead into a customer involves various tedious tasks. You need to create and send reports, sort out various onboarding issues and ensure that every task is addressed properly. Even though all these tasks are vital for your business, they are time-consuming.

A powerful CRM solution is designed to automate all these everyday tasks. Task automation saves time and allows your team to focus on more important activities.

7. Mobile CRM

Well-designed CRM software allows your team to access critical sales data instantly from their mobile device. It is essential for a business to have a robust mobile CRM to help employees access data anytime, from anywhere.

With a mobile CRM in place, your employees can manage appointments, tasks and track deals more efficiently. Long story short, with enhanced mobile CRM software system you carry your business in your pocket.

As a business owner, you need a CRM to increase efficiency and revenue. It’s increasingly difficult to remain competitive without a CRM in place. Comprehensive CRM software helps your employees automate tasks, retrieve information, and streamline all your business operations. But the key is to choose the best CRM software to meet the unique needs and requirements of your business.

<a href=””>navigate here</a>