Convert youtube videos to MP3 audio

My father-in-law who is a music enthusiast was trying to search for Ustad Ghulam Ali’s Ghazals.

He was able to watch and listen his Ghazals from YouTube at my place but he doesn’t have internet at his home. So, I decided to help him by downloading and convert songs to MP3.

Step 1:

I did google and found “youtube-dl” (for Debian Linux) and installed it on my Debian Linux. youtube-dl helped me to download playlists by running below command.

youtube-dl –playlist-start 1 –playlist-end 20 https://www.youtube.com/watch?list=PLDFC0175788C44C2D

We can further specify output format, quality etc.. but for us basic download of the Ghazals was sufficient.

Step 2:

I did search for a tool to convert MP4 to MP3 in Debian and found a tool called “avconv”. Installed and started converting the downloaded files by running the below script all at once 🙂

for i in *.mp4; do avconv -i “$i”  “out-$i.mp3” ; done

Above one liner script would convert all MP4 video files to MP3 audio files with the prefix “out” in  the file names.

Result: We now have the offline Ghazals in mp3 format ready to listen in my father-in-law’s iPod / computer!!

Note: youtube-dl would not download copyrighted, restricted and private files from YouTube.

 

Advertisement

Script to check and alert VSCAN services for NetApp

In my previous blog, I’ve shared a script to check CAVA services. That post inspired me to work on NetApp’s Vscan alerting script!!

Vscan command in NetApp 7Mode 8.1.x has very less options or switches to check whether AV server and its storage services are running or not. We only get console messages that service is available or not.

Since, most of of filers are enabled with mandatory scan (on). AV server and services are critical for CIFS shares to be available to end users. Otherwise CIFS shares would be inaccessible and causes a business outage!

VSCAN work on NetApp proprietary RPC protocol and uses TCP ports 139 and 445. These two ports help us to monitor VSCAN services availability to NetApp filers. I’ve made a simple batch and Perl script to check the status and alert to storage / security admin about the AV server and  services status.

Batch script contains a simple command as mentioned below. This script is placed in AV server and polled at 2 hour interval scheduled using task scheduler

netstat -an | find <IP Address of Netapp Filers>

About output would list the TCP connections of port 139 and 445 established between AV servers and NetApp filers. Output is saved to a file to parse it using Perl script and do a simple validation whether RPC connections are established or not.

Click below to download Perl script for reference.

netapp_vscan_chk_v01

Attached script would run from script host or one of the AV server which can access the netstat output. Perl script runs every two hours as a scheduled job.

Logic / Validation:

Each AV server need to have atleast 1 RPC port connection established with NetApp [Atleast in our setup*]. Based on this logic, we’ll come to know if AV services are available to NetApp or not. We have two controllers in our setup which means we need to have 2 RPC connections. If number of connections are less than 2 then an email alert sent to recipients which contains AV server name for easier troubleshooting.

Note: We need to have Perl & libraries, SMTP access to send email alerts and little knowledge on netstat to customize script according your setup requirements.

VNX File – Script to check CAVA servers / services availability

CAVA  – Celerra Antivirus Agent is one of the critical services in VNX-File sharing services. This would help to scan all files before read / writes from and to the CIFS shares. CAVA integrate with AV software and enables file scanning. According to best practices we need to have minimum 2 CAVA servers for each VNX-File.

I’ve made a simple Perl script which would generate email alerts in case of CAVA services are down / not available to VNX-File.

Please click the below link to download Perl script

VNX-CAVA

Note / Steps:

  • Ensure script host can reach VNX and CAVA servers
  • Please change IP address, username, password, sender email address, receiver email address and SMTP IP / or fully qualified domain name.
  • Ensure Perl and necessary modules are available to run the script
  • Subscribe to my blog if you like this 😛