In IT, our job is to make our workflow more efficient and eliminate human error. But how can we do this? Simple, write scripts that stop hours of work and even potential human mistakes. But what sets a script apart from another script?
Base Code
The simple answer is right in front of us. You can write a script that will perform the following tasks:
Go to a file share.
Copy the file from that share into a working directory to sustain the old file.
Pull the required data out of that share and put it inside a database.
Delete the copied file.
Move the old file into a backup directory and rename it.
If you write up a script like this, you will now have automated a potential task that saves 5 minutes a day. You also eliminated human error. But there is a lot of flaws with this task. It lacks the golden keys to success: Error Checking and Validation. Breaking down the code
When you go to a file share, you should include another command.
Go to a file share.
Check if the file exists.
By performing this additional step, you can now prevent the script from running and causing additional issues. Let's dig deeper into that login.
Adding some coding logic
Go to a file share.
Check if the file exists.
If the file exists, continue the script.
If the file doesn't exist, stop the script.
But it doesn't stop there. Because automation is to eliminate the need to monitor a task, if the file doesn't exist, there is a different issue we should look into. Let's take this to the next level.
Finished product
Go to a file share.
Check if the file exists.
If the file exists, continue the script.
If the file doesn't exist, stop the job process and send out an email to IT, signaling the job was not completed successfully.
The idea is we went from a self-driving car that has a brick on the gas pedal and applied coding logic. This is not advanced coding at all, but simply, it's common sense.
So when you write your next script, take yourself to the next level. Put a script in place that is going to make management feel more confident in your skills. If you write kiddie scripts, then expect management to parent your skills.
Comments