Use pschedule for a continuous sound

versatile 64-bit multi-user Linux distribution

Moderators: kirk, jamesbond, p310don, JakeSFR, step, Forum moderators

Post Reply
don570
Posts: 686
Joined: Sat Nov 21, 2020 4:43 pm
Has thanked: 5 times
Been thanked: 116 times

Use pschedule for a continuous sound

Post by don570 »

I tested pschedule in fatdog64 812 to see if it could schedule an alert with a continuous sound.
Exiting will shut off sound.

I noticed that crond service is not turned on by default, so that needs to done.
Then launch pschedule and click on 'Add'.
Fill in time and the command.

Code: Select all

#!/bin/sh
# continuous sound is heard until  window is closed


echo '
#!/bin/sh
while [ 1 ] ; do  aplay /usr/share/audio/2barks.au ; done  2>/dev/null
'  >/usr/sbin/continous_script.sh

#permissions must be given to /usr/sbin/continous_script.sh
chmod 755 /usr/sbin/continous_script.sh
/usr/sbin/continous_script.sh &
pid=$!

#  when gtkdialog window is closed  --  kill is executed
export QUIT='<window   title="Continuous Sound"  icon-name="ptiming">
 <vbox>
   <hbox homogeneous="true"><text><label>"'$(date)'"</label></text></hbox>
   <hbox homogeneous="true"><text><label>"Exit to kill sound"</label></text></hbox>
   <hbox>        
       
	  <button>
      <label>"Exit"</label>
      <action type="exit">CLOSE</action>
      </button>	   
   </hbox>
  </vbox>
 </window>
'
 gtkdialog -p QUIT -c     

kill -9  $pid 2>/dev/null

Here is the compressed script --> continuous_sound.sh
You can decompress it and place it anywhere (such as /root)
Make sure it can be executed.

continuous_sound.sh.zip
(567 Bytes) Downloaded 49 times

____________________________________

I looked in /var to see what was in the crontab file

screenshot-pschedule.jpg
screenshot-pschedule.jpg (33.16 KiB) Viewed 704 times

__________________________________________

Clarity
Posts: 3823
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1621 times
Been thanked: 521 times

Re: Use pschedule for a continuous sound

Post by Clarity »

I foresee many useful needs for this utility. I am old, and little "nudges" from utilities like this is EXTREMELY helpful. Thanks Don for bringing this to us! :thumbup:

I ask:
Should this utility have a front-end for setup of media playback selection or maybe a 'nudge.conf' file to reference media/other variable needs for the script?

In any event, thanks, MUCHLY.

don570
Posts: 686
Joined: Sat Nov 21, 2020 4:43 pm
Has thanked: 5 times
Been thanked: 116 times

Re: Use pschedule for a continuous sound

Post by don570 »

setup of media playback selection

I chose aplay because it is in all linux distros.
You can install mpg123 app and switch to it by changing one line in script.

________________________________________

There is a more sophisticated alarm ---> ptmtimer 2.6
https://oldforum.puppylinux.com/viewtop ... 83#p978483

It searches for a media player.

______________________________________

User avatar
MochiMoppel
Posts: 1232
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 21 times
Been thanked: 437 times

Re: Use pschedule for a continuous sound

Post by MochiMoppel »

don570 wrote: Wed Jan 12, 2022 6:49 pm

Code: Select all

#!/bin/sh
# continuous sound is heard until  window is closed


echo '
#!/bin/sh
while [ 1 ] ; do  aplay /usr/share/audio/2barks.au ; done  2>/dev/null
'  >/usr/sbin/continous_script.sh

#permissions must be given to /usr/sbin/continous_script.sh
chmod 755 /usr/sbin/continous_script.sh
/usr/sbin/continous_script.sh &
pid=$!

#  when gtkdialog window is closed  --  kill is executed
export QUIT='<window   title="Continuous Sound"  icon-name="ptiming">
 <vbox>
   <hbox homogeneous="true"><text><label>"'$(date)'"</label></text></hbox>
   <hbox homogeneous="true"><text><label>"Exit to kill sound"</label></text></hbox>
   <hbox>        
       
	  <button>
      <label>"Exit"</label>
      <action type="exit">CLOSE</action>
      </button>	   
   </hbox>
  </vbox>
 </window>
'
 gtkdialog -p QUIT -c     

kill -9  $pid 2>/dev/null

You could avoid creating and killing continous_script.sh by running aplay directly from gtkdialog:

Code: Select all

#!/bin/sh
export QUIT='<window title="Continuous Sound"  icon-name="ptiming">
 <vbox>
  <timer visible="false" interval="2">
    <action>aplay -q /usr/share/audio/2barks.au</action>   
  </timer>    
  <hbox homogeneous="true"><text><label>"'$(date)'"</label></text></hbox>
   <hbox homogeneous="true"><text><label>"Exit to kill sound"</label></text></hbox>
   <hbox>        
	  <button>
      <label>"Exit"</label>
      <action type="exit">CLOSE</action>
      </button>	   
   </hbox>
  </vbox>
 </window>
'
gtkdialog -p QUIT -c
don570
Posts: 686
Joined: Sat Nov 21, 2020 4:43 pm
Has thanked: 5 times
Been thanked: 116 times

timer widget

Post by don570 »

I didn't know about timer widget. :roll:
https://github-wiki-see.page/m/step-/gt ... wiki/timer
______________________________________

user1111

Re: Use pschedule for a continuous sound

Post by user1111 »

No 'at' command available in fatdog, busybox or gslapt !!!

while [ $(date +%I:%M) != "17:00" ]; do sleep 1; done

Post Reply

Return to “FatDog64”