email - vk2yld at dodo.com.au

Steve...                        

Kurri Kurri,

New South Wales

Australia

VK2YLD

  Anything you read here is free for you to dowload, mash, destroy etc, use as you see fit.   Read carefully and then read again. (then run away!)  If any of the links don't work, they're broken! (sorry!)  I will attach scripts as I go along.  As this page is new, expect a few 'broken bits'..  Any script I used or modified will still contain the original 'whos who' at the start.  I DO NOT remove other peoples header info, names, or otherwise.  Credit where credit's due!   For those of you who are interested enough, the buttons above will link you to a copy of the 'custom' folders in both scripts and audio, so you can see 'what gives' without wading through this stuff.

  Back in 2007, when I started this project, I had a snoop around at quite a few other nodes and followed some of their ideas reguarding custom decodes, features, programming etc.  The first priority as I see it, is to let people know the node is here!!  I got a copy of the IRLP Clock script and, as usual, re-hashed the code. That's how this whole mess began....

  I am a part-time programmer and learn the way all GOOD programmers learn.... error recovery method! (could also be called 'crash management')  Having said that, every thing you read here, unless otherwise noted, works fine on MY node, but may break yours. (depending on hardware, software, your lunching habits, facial expressions, phase of the moon etc etc, and your OS..)  Temporary files and working files are mostly stored in /dev/shm or /home/irlp/local which are ram disks.  This is done to speed up access and to limit disk activity especially on PI-IRLP nodes as the SD cards have a finite 'write cycle' life...

 

   ** When these scripts were written, my node was running the CentOS 4 Kernel - If you enter 'cat /proc/version' at the terminal, you would see..

Linux version 2.6.9-42.0.10.plus.c4 (mockbuild@builder4.centos.org) (gcc version 3.4.6 20060404 (Red Hat 3.4.6-3)) #1 Tue Feb 27 16:27:24 EST 2007

 

    ** After the rebuild and reload, 'cat /proc/version' now returns..

Linux version 4.19.0-16-686-pae (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.181-1 (2021-03-19)

 

     All the scripts listed here have been updated to run in the Debian environment.  A lot of the original scripts failed when run due to different version and syntax requirements of the system files.

Now a quote from another programmer, (from one of the scripts I adapted, thanks Tony ,VK3JED)

 

"If you try something and it works, excellent! if it breaks, you get to keep both pieces, and if you manage to fix it after it breaks, please document your experience so others can benefit.  it will be appreciated by someone."

In the Beginning..

LogOnLog..

Here is a little number I created to take the last 10 lines of the system log file and present them to you when you log into the node.  Instantly see what has been happening recently.  This script is best run by the root user's crontab.  It should be run every minute, and will copy the last 10 lines of the log file into the "message of the day" file ('/etc/motd') for display on login.  (Take a look at the result!)
There was a script called 'speaktime' that I looked at, but it didn't do what I wanted co the time_cron script was born.  The clock routine got bent to tell real time.  No... not UTC, REAL time like "The time is 20 to 2" instead of "The time is one fourty". You know, Real time! The basics from the standard IRLP clock remain, but sequence and calculation is altered to ..

 

   read RTC (date ...)

   store Hour, store minute

   change Hour to 12Hr time (if >12 then -12 etc)

   test if minute >30?

          - if yes, increment hour, min=60-min, hand="to"

          - if no, hand="past" and leave figures alone

 

  When the routine says the time, it keys up and says "The time is", Minute, hand, hour.  If date = 14:53, 14 gets ripped back to 2, minute test results in hour up to 3, minute set to 7 (60-53) and hand set at "to", so when the speak routine executes, the node says "The time is 7 to 3".  As the clock is called by CRON at 10 minute intervals, the figures are not usually this ugly (!), but you get the drift (but It does get this ugly when called from custom_decode though).  I created new audio files with the SWIFT voice 'Allison' from Cepstral (see links page), but reduced it to 1-20, 30, 40, 50, to, past, the time is. Using pre-recorded files makes the clock's response somewhat quicker than using the TTS engine.    The whole package is available in the scripts area as 'time_cron_pack'.  I also added a couple of flag tests to the code...

   - first flag is ~/stopmsgs - if this flag is present the clock won't send out the welcome sprook on the hour (or 1/2 hour). 

   - second flag is ~/weathertime - this one triggers the 'weather' function of the script each clock run ,and that transmits the current temperature from 'weatherzone.com'.

      It uses weatherzone because the Met Bureau no longer supports automated data retrieval.

IRLP Clock - time-cron..

  I have a SB-128 PCI in this node and although it has an on-board synth, for some reason unknown to me, it does'nt work with Alsa.  I get no 'synth' slider in aumix and it won't generate cw either ...bummer.... so...enter the KK7AV CW-ID script.  As you have probably guessed by now, refinements, tweaks etc... gotta' do it.  I didn't use the auto install for this as I like to see what kills the node before resuscitation is required. (no offence intended) The only change I had to this one was running in repeater's cron table instead of root's.  Now for the 'bendy' bit.  The ID is triggered after the time-cron script speaks the time. The trigger file is touched about line 91 of 'time-cron' to trigger an ID sequence.

  I have done two mods to this file.  Firstly, makes a log entry after sending IDs, then another mod that removed the id_file from the config list and added a check for a flag of $LOCAL/id_voice.  This flag file passes the WAVE file to play.  The log entry either says "CWID Transmitted" or "Voice ID File Played", so the log knows what went to air.  To use the mod manually, type something like...

 

   echo "/home/irlp/custom/info/dial9.wav" > $LOCAL/id_voice    # (this passes the file name (use absolute path) inside flag)

   touch $LOCAL/id_trigger                                                        # (trigger the ID sequence to play the file)

 

  If you want the CW sent after the announcement, add a sleep 1, then touch $LOCAL/id_trigger again.  The id_voice flag is removed after playback to automatically switch back to CW.  A quick mod to the time-cron file says 'if minute = 30 or 00 then echo....' to setup the voice and the trigger gets set anyway so you get a voice announcement on the half hour without mashing a conversation in progress. (if there is one).  Now a truly multi-purpose script.. thanks Rob...

CW-ID KK7AV style plus..

PlayRemoteData..

  This script was a real teaser to write, maybe challenge is a better way of describing it...  There are a few scripts out there to do something like this, however, as usual, less is more, more or less... right?   It all started with a remote time script that accessed a database for it's response, either time or status, but the status only read 'idle' etc and not 'how long'.  I looked at the status page from http://status.irlp.net and it has all the guff I wanted,so.....  A total re-write ensued...

  The script still has config at the start, that MUST match the codes in custom_decode and MUST have the whole received DTMF passed to it from custom_decode as before.  It now responds to 3 codes to play remote time, status and location.  Ever heard a call come in from node XYZZ and wondered, 'where the hxxx is that?'.  Well here's the answer...  I set the codes to 1*xxxx, 2*xxxx and 3*xxxx being time, status and locality so, want to know where a node is? Dial 3*nnnn and the box replies with the city, country, callsign and operating frequency details for that node.  2*nnnn to find out if it's idle or not and how long it's been this way.  1*nnnn to find out if anyone will be awake if you try to call it back!

  All this data is fished from the status page, but this turned out to be more of a challenge than I first thought because the page is known to have been dumped in at least 5 different formattings!  Although they all look the same in a browser, the command "lynx -source page.psp" dumps a different output format... hmmm, puzzling.  Now it's figured out, the script is reliable.. phew!

  As you can imagine, this requires a bucket load of audio files so... a TTS engine is the way to go..  Notice how IDLE is actually read as 'eyedle'. Looks shocking but sounds right... Mechanical voices - go figure! (just eyedling along...)

News Broadcasting..

OK... This one's a real pain... but here goes... There are quite a few dependencies required for this to function.  Before you start, you will need to make sure the following services etc are installed and ready to go :- Postfix or sendmail - the mailer daemon, mutt - the Email client, curl - URL downloader, mpg123 - mp3 player, lame - an mp3 file encoder/converter.  These packages are available through 'apt-get' system repositories.  The scripts you will need are getnews, playnews, stopnews, coswatch and coscounter.  Copy these to /home/irlp/custom ($CUSTOM) and make sure they are executable.  You will also need some audio files in $AUDIO/custom/news. These files can be downloaded from the 'IRLP Audio Files' button above as 'news_audio_pack.zip' .  Edit the files getnews and playnews with nano to set the configuration section at the start of the script.

 

              Now... this is how it all pieces together....  (I think...)

 

  In your crontabs, add entries to get the programme files.  Use the copy of custom.crons in the script directory here as a guide to activating getnews etc..  As user repeater, create the following directories:- /home/irlp/news_archive (for archiving copies of downloaded files if needed), /home/irlp/audio/custom/news (where all the work takes place).  I will explain WIA first, as it is the most complex.

  When the programmed time arrives as set in the crontab, 'getnews wia' is run (or 'getnews all').  This script uses 'curl' to go to the WIA website and download the program file.  It is saved to $AUDIO/custom/news (created above) and a copy with the current date added to the filename is written to the /news_archive directory.  If you don't add the '> /dev/null 2>&1' to the end of the command in custom.crons (like me!), the screen output during the transfer is saved and emailed to the 'repeater' user from the cron daemon.  If you don't care about the download failing etc, add the pipe, but I like to know the download happened anyway..  At the programmed time, the playnews script is run by cron.  This script is timed to run 1 minute before the actual broadcast so the primer can be transmitted ("please stay tuned .."etc)..  The command line for playnews accepts wia, wiaacb, wiamcb to play the news.  Just 'wia' plays the news and runs away, 'wiaacb' plays the news & does auto callbacks, 'wiamcb' plays the news and halts for a manual callback session with a 'net controller'.  Please don't run 'wiamcb' from cron....when it stops....aaarrghhh.... the node will remain disabled and everyting stops until you manually reset it all.. not good..

  While the news is playing, if you want to abort the program, open a terminal and run 'stopnews'.  This will abort the player and re-enable the node bypassing all callbacks etc.  If you run the node as a repeater or full-duplex node, add a decode for stopnews to custom_decode and you can abort playback with DTMF.  Note however, if you have a simplex node, the news will have to run to completion if you can't get to a terminal to stop it!  WIA news is the only programme that is setup for callbacks, others just play and exit.

   'getnews' will fetch wia, wiaq (VK4), AR Newsline, ARRL Audio News, RSGB Audio News, VK5 local, VK6 NewsWest, VK7 local, This Week in Amateur Radio, RAOTC Monthly and NZART monthly.  'getnews all' will get everything, one after the other excepting RAOTC and TWIAR.

  'getnews arnl' gets the AR Newsline program from the podcast by using lynx to dump the rss feed page, fish through it and get the current podcast filename, then uses curl to go fetch it.

  The other news files are fairly straight forward too, and if you start getnews with no command (./getnews), it will spit out a usage prompt and you can see what it will retrieve for you.

   My node runs this file every night from crontab.  It emails a system status report to my email account using mutt to let me know what has been happening in the node.  It reports CPU load, file system status and a log summary complete with lines from the current logfile.

 

Logmail..

---== REMEMBER - BACKUP REGULARLY ==---

  Before I get too carried away, the 'IRLP Script Files' button will display a list of files as found in the '/home/irlp/custom' folder..  I will give a quick blurb about some of the files here, but most of them should be pretty straight forward.  If you have any questions or need any help, feel free to email me and I will be happy to try to help you out where I can.  I have documented a few scripts, but not by any means ALL of them.  Most (!) scripts have a header explaining what, why and how etc..  Please browse and play...

Some IRLP scripts