Upload
jeremie-charlet
View
160
Download
3
Embed Size (px)
Citation preview
Introduction
Why use the shell?(copy/paste from “Why automate?” slide from “Getting Started with Puppet - PuppetConf
2013” https://www.youtube.com/watch?v=TdAmAj3eaFI)
•Speed•Consistency•To get to fun things
3
PLAN
Demonstration and quick displays of code on the following topics:
1.Start simple: analyse some logs2.Write your own scripts3.Reuse your scripts to do automation
5
1. Start simple: to analyse logs
Read the logs of one batch application•Find out if there are any errors•List the document ids in error
Check whether those documents exists in the collection
6
Useful commandsLsEchowc -l
Cat / more / less
touchVi / vim / emacs
Grep / egrep / zgrepFind
AwkSedCut
Xargs
HostWgetCurl
Watchps
MongoJavaMysqlgit
8
A few hints
• Add colours to your shell
• If you do something frequently…….…… write a script
• Get the job done, do not polish it, you will get to it on next time
9
Happy Consequences
• You do not prevent yourself from writing scripts because it is going to take ages
• You progress and learn gradually, over time
• You stop looking for big tools, you answer simple needs with simple solutions
> Example: Monitoring tool for daily updates on categories
10
3. Reuse your scripts to do automation
Sample with the Monitoring tool
Cron (scheduled task) ran every day
Script to monitor: monitorDailyUpdates.sh
Dependencies:• checkDailyUpdates.sh• sendMail.sh