[App_rpt-users] additional- app_rpt_script_execution

Doug Crompton doug at crompton.com
Wed Jul 23 03:57:26 UTC 2014


Ramon,

 For simpleusb it would be -

asterisk -rx "susb key"    (or unkey)

I think there is a similar command for usbradio
73 Doug
WA3DSP
http://www.crompton.com/hamradio


Date: Tue, 22 Jul 2014 21:33:23 -0400
From: kp4tr.ramon at gmail.com
To: mike at midnighteng.com; App_rpt-users at ohnosec.org
Subject: Re: [App_rpt-users] additional- app_rpt_script_execution


  
    
  
  
    Got the script to reboot working...

      

      My next question...how do I activate the PTT using a DMK URI FOB
      pin 1 using a "cop" command?

      

      I know it must be a:   asterisk -rx "rpt cmd 2000 cop 62,GPIO1=1
      0" or something similar, but I can't figure out what GPIO the PTT
      line is (I think it's GPIO1) or if there is another way to do it.

      

      The reason for this is that I would like to write custom scripts
      to announce things like my IP address, my wireless SSID name, etc
      by using DTMF commands via Allstar.

      

      Thanks.

      

      

      On 7/22/2014 5:19 AM, mike at midnighteng.com wrote:

    
    
        

        
        

        
        Bob,
        

        
        Sorry only a short time for reply...
        

        
        make a file with nano,vi or whatever and call it shutdowncmd.sh
        

        
        place the commands in it you use to shutdown the machine
        ex: shutdown -P NOW
        

        
        change attributes to 755 and place in usr/local/sbin/ 
        

        
        create a command that matches no other in your rpt.conf
          node stanza (use 5 or more digits)

        
        xxxx=CMD,/usr/local/sbin/shutdowncmd.sh   
        

        
        test your script file by running it from the command line
          once... shutdowncmd.sh

        
        

        
        to call the script, enter dtmf xxxx or use in a macro to do
          many things during a shutdown.
        

        
        Hopefully, I did not leave anything out...  73

        
        

        
        ...mike/kb8jnm
        

        
        

        
        
          
            -------- Original Message --------

            Subject: Re: [App_rpt-users] additional-
            app_rpt_script_execution

            From: "(KP4TR)Ramon Gonzalez" <kp4tr.ramon at gmail.com>

            Date: Mon, July 21, 2014 11:43 pm

            To: App_rpt-users at ohnosec.org

            

            Hello,

              

              I would like to write a macro to perform a shutdown of my
              server using a DTMF command. Basically I want to run a
              shell script from a function using a macro. Can someone
              point me to some documentation on how this can be
              accomplished?

              

              

              Thanks.

              

              

              On 3/9/2014 1:11 PM, Bob wrote:

            
            
                
              
              
                Doug, Mike,
                      Bryan... thanks all... need to read more about
                      cron... each set, as well as the combined comments
                      helped me tremendously. I copied them here so I
                      can keep them together.
                 
                Thanks much!
                Bob
                kk6ecm
                 
                 
                 
                -----Original
                      Message-----

                      From: app_rpt-users-bounces at ohnosec.org
                      [mailto:app_rpt-users-bounces at ohnosec.org]
                      On Behalf Of Bryan D. Boyle

                      Sent: Sunday, March 09, 2014 9:30 AM

                      To: app_rpt mailing list

                      Subject: Re: [App_rpt-users] app_rpt script
                      execution
                 
                Read up on
                      the 'cron' command.
                 
                Use
                      asterisk to do what asterisk does (interface and
                      manage the radios).
                Use the
                      operating system to do what operating systems do
                      (download
                files,
                      manage network connections, disk I/O, etc.)
                 
                Write a
                      shell script that downloads the file on a regular
                      schedule and
                save the
                      mp3 or wav or whathaveyou file to disk (wget/curl
                      is your friend).
                Write a
                      shell script to play the script, assign it to a
                      dtmf command in
                rpt.conf
                use the
                      schedule stanza inside asterisk to execute the
                      dtmf command you
                assigned to
                      the shell script at the requisite time.
                 
                Again, use
                      asterisk to do what aterisk does.
                Use the OS
                      to do what it's supposed to do.
                 
                Simplifies
                      things immensely.
                 
                 
                 
                
                       
                From: hotmail_97fc649978f54bf0 at live.com
                      [mailto:hotmail_97fc649978f54bf0 at live.com]
                      On Behalf Of Doug
                      Crompton

                      Sent:
                      Sunday, March 09, 2014 9:44 AM

                      To:
                      Bob

                      Cc: app_rpt-users at ohnosec.org

                      Subject:
                      RE: [App_rpt-users] app_rpt script execution
                 
                Bob,

                      

                       The easiest way to execute scripts that command
                      app_rpt is outside of rpt.conf in this way....

                      

                      Create a script and store it somewhere (example) -

                      

                      #! /bin/bash

                      /usr/sbin/asterisk -rx "rpt fun 27225 *7128190"

                      sleep 10

                      /usr/sbin/asterisk -rx "rpt fun 27225 *7327133"

                      

                      I call this script alaska_connect and it is in
                      /etc/asterisk/wa3dsp  Make sure it s executable -
                      chmod 750 <filename>

                      

                      Then create a cron job to tell when to execute it
                      -

                      

                      44 12 * * 1-6 /etc/asterisk/wa3dsp/alaska_connect

                      

                      This says execute
                      /etc/asterisk/wa3dsp/alaska_connect at 12:44 (PM
                      the clock is 24 hour) on Monday through Saturday

                      

                      Use crontab -e   to edit  cron   or crontab -l to
                      list what is there. Google cron or crontab to see
                      cron options.

                      

                      As you can see this has nothing to do with
                      anything inside of rpt.conf  Remove any scheduled
                      jobs in rpt.conf especially if they conflict with
                      doing it in this way externally.

                      

                      The script can be any system command or anything
                      you could do from the command prompt, download a
                      file, reboot the system, send commands to app_rpt,
                      restart asterisk, whatever.

                      

                    73 Doug

                        WA3DSP

                        http://www.crompton.com/hamradio

                      

                      
                
                  
                         
                  From: app_rpt-users-bounces at ohnosec.org
                        [mailto:app_rpt-users-bounces at ohnosec.org]
                        On Behalf Of mike at midnighteng.com

                        Sent:
                        Sunday, March 09, 2014 9:48 AM

                        To:
                        app_rpt-users at ohnosec.org

                        Subject:
                        Re: [App_rpt-users] additional-
                        app_rpt_script_execution
                
                 
                
                  

                        Some additional here bob...
                
                
                   
                
                
                  I
                        did not read you message properly the first
                        time.
                
                
                  If
                        you are not sure where your script is running
                        from (like you installed something and do not
                        understand how it works) , it is probably being
                        executed from the system cron.  /etc/crontab (do
                        not edit this file with a "windows" based
                        editor)
                
                
                  It
                        is probably calling a script file that you will
                        have to look in crontab to find what and where
                        it is.
                
                
                   
                
                
                  So
                        if you are trying to change that to the app_rpt
                        system sched/macro, you will need to remove it
                        from crontab first.
                
                
                   
                
                
                  Here
                        is some info on using the app_rpt macro/sched
                
                
                   
                
                
                  http://ohnosec.org/drupal/node/143
                
                
                  http://themidnightengineer.com/category/ham-amateur-radio/app_rpt/macros-scheduler/
                
                
                   
                
                
                   
                
                
                  ...mike/kb8jnm
                
                
                   
                
                
                  
                    --------
                          Original Message --------

                          Subject: Re: [App_rpt-users]
                          app_rpt_script_execution

                          From: <mike at midnighteng.com>

                          Date: Sun, March 09, 2014 12:25 pm

                          To: app_rpt-users at ohnosec.org
                    
                       
                    
                    
                      Bob,
                    
                    
                       
                    
                    
                      Without
                            knowing the exact nature, I can give some
                            advice on this as I do run scripts from the
                            app_rpt sched over the use of system cron
                            and there are good and bad doing it that
                            way.
                    
                    
                       
                    
                    
                      But
                            here is some guidance...
                    
                    
                       
                    
                    
                      You
                            can put the scripts in the /etc/asterisk
                            folder (I use /etc/asterisk/scripts ) but
                            you need to make sure you set file
                            permissions to say 755 on the script file
                            and be sure to call them specifically from
                            their location or set a path to your
                            directory. 
                    
                    
                       
                    
                    
                      Also
                            note that any item you call in the script
                            would have the same permission/path problem
                            so do not assume you can run a file/command
                            (as you would from "root" command line)
                            without saying where it is with a path to it
                            in the command line. And having the
                            permissions set to run it.
                    
                    
                       
                    
                    
                      If
                            you are trying to keep security on files,
                            you might run them as user: "asterisk". 
                    
                    
                       
                    
                    
                      Hope
                            that is of some value...
                    
                    
                       
                    
                    
                      ...mike/kb8jnm
                    
                    
                       
                    
                    
                       
                    
                    
                      
                        --------
                              Original Message --------

                              Subject: [App_rpt-users] app_rpt script
                              execution

                              From: "Bob" <kk6ecm at gmail.com>

                              Date: Sun, March 09, 2014 12:08 pm

                              To: <app_rpt-users at ohnosec.org>
                        
                          
                            I’m
                                  working on a node that downloads a
                                  file from the internet weekly, but the
                                  time seems to vary. I want to change
                                  this to a specific day and time each
                                  week, but cannot determine what is
                                  activating the script. The script is
                                  located in /etc/asterisk/. rpt.conf
                                  uses the file per its [schedule]
                                  stanza. I have two questions:
                          
                          
                             
                          
                          
                            Does
                                  the server only load/execute files in
                                  /etc/asterisk each time asterisk is
                                  started?
                          
                          
                            How
                                  can I setup the system so it executes
                                  this script at a given time each week?
                                  
                          
                          
                             
                          
                          
                            Thanks,
                          
                          
                            Bob
                          
                          
                            kk6ecm
                          
                          
                             
                          
                        
                      
                    
                  
                
              
              

              
              

              _______________________________________________
App_rpt-users mailing list
App_rpt-users at ohnosec.org
http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users

To unsubscribe from this list please visit http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users and scroll down to the bottom of the page. Enter your email address and press the "Unsubscribe or edit options button"
You do not need a password to unsubscribe, you can do it via email confirmation. If you have trouble unsubscribing, please send a message to the list detailing the problem. 
            
            

            _______________________________________________

            App_rpt-users mailing list

            App_rpt-users at ohnosec.org

            http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users

            

            To unsubscribe from this list please visit http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users
            and scroll down to the bottom of the page. Enter your email
            address and press the "Unsubscribe or edit options button"

            You do not need a password to unsubscribe, you can do it via
            email confirmation. If you have trouble unsubscribing,
            please send a message to the list detailing the problem. 
        
      
      

      
      

      _______________________________________________
App_rpt-users mailing list
App_rpt-users at ohnosec.org
http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users

To unsubscribe from this list please visit http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users and scroll down to the bottom of the page. Enter your email address and press the "Unsubscribe or edit options button"
You do not need a password to unsubscribe, you can do it via email confirmation. If you have trouble unsubscribing, please send a message to the list detailing the problem. 
    
    

  


_______________________________________________
App_rpt-users mailing list
App_rpt-users at ohnosec.org
http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users

To unsubscribe from this list please visit http://ohnosec.org/cgi-bin/mailman/listinfo/app_rpt-users and scroll down to the bottom of the page. Enter your email address and press the "Unsubscribe or edit options button"
You do not need a password to unsubscribe, you can do it via email confirmation. If you have trouble unsubscribing, please send a message to the list detailing the problem. 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.keekles.org/pipermail/app_rpt-users/attachments/20140722/705d2c32/attachment.html>


More information about the App_rpt-users mailing list