Nugget Post : Beyond basic SED

Interesting problem to solve with sed. Given the following file: [firstCompany-1-restricted-internal] exten => _1XX,1,Goto,(from-internal,${EXTEN},1) exten => _881XX,1,Goto(from-internal,${EXTEN},1) exten => _XXX,1,Goto(app-blackhole,congestion,1) exten => _XXXXX,1,Goto(app-blackhole,congestion,1) exten => _9XXXX.,1,Dial(SIP/BRI_1_OUT/${EXTEN},60) exten => h,1,Hangup() [secondCompany-2-restricted-internal] exten => _2XX,1,Goto,(from-internal,${EXTEN},1) exten => _882XX,1,Goto(from-internal,${EXTEN},1) exten => _XXX,1,Goto(app-blackhole,congestion,1) exten => _XXXXX,1,Goto(app-blackhole,congestion,1) exten => _[*0-9]!,1,Set(restprefix=1001992) exten => _[*0-9]!,1,Goto(from-internal,${restprefix}${EXTEN},1) exten => h,1,Hangup() We'd like to be … Continue reading Nugget Post : Beyond basic SED

Advertisements

Bash scripting: another use for “DD”

For most linux users, "dd" is mostly used when dealing with disk issues, such as copying one disk to another (byte for byte) creating an ISO from a CD/DVD, and so on. I personally didnt know what else I would use dd for until I ran across a particular need.... I needed my linux script … Continue reading Bash scripting: another use for “DD”

Creating a custom Nagios/Centreon passive alerter

Scenario: This is very probably a familiar problem that any sysadmin must solve: Using your monitoring setup to receive alerts from other servers. Note the highlighted "receive". This is different from the standard poll / check that come out of the box with Nagios. Say for example, you would like to receive an alert whenever … Continue reading Creating a custom Nagios/Centreon passive alerter

Linux script for automatic notification of failed download

Scenario: We need a CentOS machine to periodically automatically download a file from a remote server on the internet. If this download fails for any reason, the network admin should be emailed to investigate further. Resolution: A simple cron job can be used which executes a download script. The following script was used: #!/bin/bash wget … Continue reading Linux script for automatic notification of failed download